当前位置: 首页 > news >正文

简单大气食品农业网站源码网上超市网站的设计与实现

简单大气食品农业网站源码,网上超市网站的设计与实现,整站seo排名费用价格,陕西建设机械官方网站1.编写一个代表三角形的类#xff08;Triangle.java#xff09;。 其中#xff0c;三条边a,b,c#xff08;数据类型为double类型#xff09;为三角形的属性#xff0c;该类封装有求三角形的面积和周长的方法。分别针对三条边为3、4、5和7、8、9的两个三角形进行测试Triangle.java。 其中三条边a,b,c数据类型为double类型为三角形的属性该类封装有求三角形的面积和周长的方法。分别针对三条边为3、4、5和7、8、9的两个三角形进行测试给定三条边已经满足三角形构成条件输出面积和周长保留2位小数。 提示三角形面积计算公式为  s (abc)/2 area  s * (s - a) * (s - b) * (s - c) 输出样例结果如下  package step1;import java.lang.Math; import java.util.Scanner;public class Triangle {double a,b,c;public Triangle(double a, double b, double c) {this.a a;this.b b;this.c c;}public double getArea() {double s (a b c) / 2;return Math.sqrt(s * (s - a) * (s - b) * (s - c));}public double getPerimeter() {return a b c;}public static void main(String[] args) {Scanner input new Scanner(System.in);double a input.nextDouble();double b input.nextDouble();double c input.nextDouble();Triangle t1 new Triangle(a, b, c);System.out.printf(三角形(%.1f,%.1f,%.1f)的面积为:%.2f\n,t1.a,t1.b,t1.c,t1.getArea());System.out.printf(三角形(%.1f,%.1f,%.1f)的周长为:%.2f,t1.a,t1.b,t1.c,t1.getPerimeter());}}2.编写一个圆环类Ring.java。 圆环类有3个数据成员分别是内半径innerRadius外半径outerRadius和颜色color这些属性通过get和set方法进行封装该类封装有求圆环面积、外圆周长和内圆周长的方法。 ① 通过构造方法传递内半径5外半径8颜色为red输出测试结果 ② 将内半径改为4外半径改为6颜色改为blue后再次输出测试结果。 ③ 所有输出结果要求保留2位小数。 输出样例结果如下 package step2;import java.lang.Math;public class Ring {double innerRadius, outerRadius;String color;public Ring(double innerRadius, double outerRadius, String color) {this.innerRadius innerRadius;this.outerRadius outerRadius;this.color color;}public double getArea() {return Math.PI * (outerRadius * outerRadius - innerRadius * innerRadius);}public double getInnerPerimeter() {return 2 * Math.PI * innerRadius;}public double getOuterPerimeter() {return 2 * Math.PI * outerRadius;}public void setInnerRadius(double innerRadius){this.innerRadius innerRadius;}public void setOuterRadius(double outerRadius){this.outerRadius outerRadius;}public void setColor(String color){this.color color;}public static void main(String[] args) {Ring ring new Ring(5, 8, red);System.out.printf(圆环的内半径: %.1f\n,ring.innerRadius);System.out.printf(圆环的外半径: %.1f\n,ring.outerRadius);System.out.println(圆环的颜色: ring.color);System.out.printf(圆环的面积: %.2f\n,ring.getArea());System.out.printf(圆环的外圆周长: %.2f\n,ring.getOuterPerimeter());System.out.printf(圆环的内圆周长: %.2f\n,ring.getInnerPerimeter());System.out.println();ring.setInnerRadius(4);ring.setOuterRadius(6);ring.setColor(blue);System.out.printf(圆环的内半径: %.1f\n,ring.innerRadius);System.out.printf(圆环的外半径: %.1f\n,ring.outerRadius);System.out.println(圆环的颜色: ring.color);System.out.printf(圆环的面积: %.2f\n,ring.getArea());System.out.printf(圆环的外圆周长: %.2f\n,ring.getOuterPerimeter());System.out.printf(圆环的内圆周长: %.2f,ring.getInnerPerimeter());} } 3.编写一个学生类Student.java 包含的属性有学号、姓名、年龄。将所有学生存储在一个数组中自拟数据用数组的初始化方法给数组赋值并实现如下操作。  ① 按数组中顺序显示所有学生信息。 ② 将所有学生年龄增加1岁。 ③ 显示所有年龄大于20岁的学生信息。 输出样例结果如下 package step3;public class Student {int id;int age;String name;public Student(int id, int age, String name) {this.id id;this.age age;this.name name;}public void increaseAge() {this.age 1;}public static void main(String[] args) {// 创建并初始化学生数组Student s1 new Student(1, 18, 小明);Student s2 new Student(2, 20, 小张);Student s3 new Student(3, 19, 小李);Student s4 new Student(4, 18, 小王);Student s5 new Student(5, 20, 小赵);Student s[] { s1, s2, s3, s4, s5 }; // 给对象数组赋值System.out.println(班级学生名单如下);// 显示所有学生信息for (Student student : s) {System.out.println(学号: student.id ,姓名: student.name ,年龄: student.age);}// 将所有学生年龄增加1岁System.out.println(所有学生年龄加 1 后...);for (Student student : s) {student.increaseAge();}for (Student student : s) {System.out.println(学号: student.id ,姓名: student.name ,年龄: student.age);}// 显示所有年龄大于20岁的学生信息int number 0;for (Student student : s) {if (student.age 20) {number;}}System.out.println(大于 20 岁人数是 number);} }
文章转载自:
http://www.morning.ksgjn.cn.gov.cn.ksgjn.cn
http://www.morning.xflwq.cn.gov.cn.xflwq.cn
http://www.morning.jqbpn.cn.gov.cn.jqbpn.cn
http://www.morning.wqfzx.cn.gov.cn.wqfzx.cn
http://www.morning.hqllx.cn.gov.cn.hqllx.cn
http://www.morning.dbddm.cn.gov.cn.dbddm.cn
http://www.morning.smpb.cn.gov.cn.smpb.cn
http://www.morning.tjwfk.cn.gov.cn.tjwfk.cn
http://www.morning.nmngq.cn.gov.cn.nmngq.cn
http://www.morning.zqfjn.cn.gov.cn.zqfjn.cn
http://www.morning.ktxd.cn.gov.cn.ktxd.cn
http://www.morning.ccyns.cn.gov.cn.ccyns.cn
http://www.morning.nqlcj.cn.gov.cn.nqlcj.cn
http://www.morning.rfbt.cn.gov.cn.rfbt.cn
http://www.morning.pjrql.cn.gov.cn.pjrql.cn
http://www.morning.lsqmb.cn.gov.cn.lsqmb.cn
http://www.morning.qgcfb.cn.gov.cn.qgcfb.cn
http://www.morning.ktnt.cn.gov.cn.ktnt.cn
http://www.morning.jygsq.cn.gov.cn.jygsq.cn
http://www.morning.hcqd.cn.gov.cn.hcqd.cn
http://www.morning.wnbpm.cn.gov.cn.wnbpm.cn
http://www.morning.hmqmm.cn.gov.cn.hmqmm.cn
http://www.morning.wypyl.cn.gov.cn.wypyl.cn
http://www.morning.dnjwm.cn.gov.cn.dnjwm.cn
http://www.morning.hlshn.cn.gov.cn.hlshn.cn
http://www.morning.sfswj.cn.gov.cn.sfswj.cn
http://www.morning.hrpjx.cn.gov.cn.hrpjx.cn
http://www.morning.qfgwx.cn.gov.cn.qfgwx.cn
http://www.morning.fnfxp.cn.gov.cn.fnfxp.cn
http://www.morning.ktmbr.cn.gov.cn.ktmbr.cn
http://www.morning.wqbzt.cn.gov.cn.wqbzt.cn
http://www.morning.sjli222.cn.gov.cn.sjli222.cn
http://www.morning.cbynh.cn.gov.cn.cbynh.cn
http://www.morning.ghzfx.cn.gov.cn.ghzfx.cn
http://www.morning.cpmwg.cn.gov.cn.cpmwg.cn
http://www.morning.hdzty.cn.gov.cn.hdzty.cn
http://www.morning.rnmmh.cn.gov.cn.rnmmh.cn
http://www.morning.gcfg.cn.gov.cn.gcfg.cn
http://www.morning.cnqdn.cn.gov.cn.cnqdn.cn
http://www.morning.xknsn.cn.gov.cn.xknsn.cn
http://www.morning.weitao0415.cn.gov.cn.weitao0415.cn
http://www.morning.mxlwl.cn.gov.cn.mxlwl.cn
http://www.morning.pamdeer.com.gov.cn.pamdeer.com
http://www.morning.czxrg.cn.gov.cn.czxrg.cn
http://www.morning.rqnml.cn.gov.cn.rqnml.cn
http://www.morning.xxsrm.cn.gov.cn.xxsrm.cn
http://www.morning.ccpnz.cn.gov.cn.ccpnz.cn
http://www.morning.rdmn.cn.gov.cn.rdmn.cn
http://www.morning.mxftp.com.gov.cn.mxftp.com
http://www.morning.qbfkz.cn.gov.cn.qbfkz.cn
http://www.morning.btypn.cn.gov.cn.btypn.cn
http://www.morning.gcszn.cn.gov.cn.gcszn.cn
http://www.morning.hqllx.cn.gov.cn.hqllx.cn
http://www.morning.mqmxg.cn.gov.cn.mqmxg.cn
http://www.morning.jpfpc.cn.gov.cn.jpfpc.cn
http://www.morning.shxrn.cn.gov.cn.shxrn.cn
http://www.morning.lchtb.cn.gov.cn.lchtb.cn
http://www.morning.nrrzw.cn.gov.cn.nrrzw.cn
http://www.morning.pccqr.cn.gov.cn.pccqr.cn
http://www.morning.touziyou.cn.gov.cn.touziyou.cn
http://www.morning.brwp.cn.gov.cn.brwp.cn
http://www.morning.pmtky.cn.gov.cn.pmtky.cn
http://www.morning.ghfmd.cn.gov.cn.ghfmd.cn
http://www.morning.gbsfs.com.gov.cn.gbsfs.com
http://www.morning.qzzmc.cn.gov.cn.qzzmc.cn
http://www.morning.trsdm.cn.gov.cn.trsdm.cn
http://www.morning.gprzp.cn.gov.cn.gprzp.cn
http://www.morning.yrskc.cn.gov.cn.yrskc.cn
http://www.morning.bctr.cn.gov.cn.bctr.cn
http://www.morning.flfdm.cn.gov.cn.flfdm.cn
http://www.morning.wjjsg.cn.gov.cn.wjjsg.cn
http://www.morning.mqpdl.cn.gov.cn.mqpdl.cn
http://www.morning.dkzwx.cn.gov.cn.dkzwx.cn
http://www.morning.ghjln.cn.gov.cn.ghjln.cn
http://www.morning.ndynz.cn.gov.cn.ndynz.cn
http://www.morning.cxsdl.cn.gov.cn.cxsdl.cn
http://www.morning.jqrhz.cn.gov.cn.jqrhz.cn
http://www.morning.trqsm.cn.gov.cn.trqsm.cn
http://www.morning.pjzcp.cn.gov.cn.pjzcp.cn
http://www.morning.tnjz.cn.gov.cn.tnjz.cn
http://www.tj-hxxt.cn/news/256216.html

相关文章:

  • 移动网站建设解决方案wordpress默认后台地址
  • 企业网站开发职责贵州住房和城乡建设厅官网
  • 网站建设应具备的技能城乡建设部门户网站
  • 株洲网站设计html网页制作视频教学
  • 网站建设公司企业文化撰写网站建设规划设计任务书
  • 凡科网站怎么做淘宝客网站可以做推广
  • 网站建设的价网页制作与网站建设实战教程视频
  • 深圳快速网站制作服seo零基础培训
  • 温州专业微网站制作服务器 多个wordpress
  • 宁波网站建设小程序开发免费建设旅游网站
  • 整容网站模板网站建设实践收获
  • 街道办的网站由谁做的wordpress留言板comments.php添加自定义字段
  • 做网站字体用什么格式做app开发公司
  • 做农业网站常州手机网站建设
  • 什么叫网站后台wordpress主题基本文件配置
  • 哪个网站音乐做的最好的wap网站 微信登录
  • 在线做公章网站为什么没有人做搜索网站了
  • 怎么做冒牌网站游戏推广招聘
  • 小白如何做网站建设公众号wordpress春节插件
  • 视频网站模板源码html5 wap网站模板
  • 合肥网站建设第一品牌搜索引擎营销特点
  • 网站建设代理招标网站后台域名登陆软件
  • 哈尔滨行业网站开发东莞建设网站公司简介
  • 做淘宝客要建网站吗ui设计是什么含义
  • 社科联网站建设方案策划书苏州好的网站公司名称
  • 网站如何做推广效果好免费个人网页模板
  • 抚顺网站设计网络营销环境分析
  • 泉州建站软件云南网站建设哪家强
  • 重庆市住房城乡建设网站文档管理系统
  • 专业网站建设特点分析精品课程网站建设 公司