发布房屋信息java代码,房屋租赁java源代码
java泛型写接收用户输入的信息,选择需要购买的房屋。可供选择的房屋有:别墅和房
public class House {
站在用户的角度思考问题,与客户深入沟通,找到阳江网站设计与阳江网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:成都网站制作、成都网站设计、企业官网、英文网站、手机端网站、网站推广、域名与空间、网页空间、企业邮箱。业务覆盖阳江地区。
String name;
float price;
String location;
float area;
public House(){
}
public House(String name, float price, String location, float area) {
super();
this.name = name;
this.price = price;
this.location = location;
this.area = area;
}
public String buy(){
return "";
}
}
public class Apartment extends House {
int floor;
public Apartment() {
super();
// TODO Auto-generated constructor stub
}
public Apartment(String name, float price, String location, float area,
int floor) {
super(name, price, location, area);
// TODO Auto-generated constructor stub
this.floor = floor;
}
public String buy() {
return "楼房: " + this.name + "\n价格: " + this.price + "\n地址: "
+ this.location + "\n面积: " + this.area + "\n层数: " + this.floor;
}
}
public class Build extends House {
int gardon;
public Build() {
super();
// TODO Auto-generated constructor stub
}
public Build(String name, float price, String location, float area,
int gardon) {
super(name, price, location, area);
// TODO Auto-generated constructor stub
this.gardon = gardon;
}
public String buy() {
return "别墅: " + this.name + "\n价格: " + this.price + "\n位置: "
+ this.location + "\n面积: " + this.area + "\n花园: " + this.gardon;
}
}
import java.util.Scanner;
public class Test {
private static Scanner input = new Scanner(System.in);
public static void main(String[] args){
Build build = new Build("别墅1", 700, "乱葬岗", 900, 12);
Apartment apartment = new Apartment("贫民窟", 300, "跳桥底", 10, 5);
System.out.println("1-买楼 2-买别墅\nInput: ");
int choice = input.nextInt();
if(1==choice){
System.out.println(apartment.buy());
}else if(2==choice){
System.out.println(build.buy());
}
}
}
求教用jsp怎么编房屋信息发布系统
JSP是动态网页技术,HTML则是静态的,我们编写JSP网页,是需要用到一些HTML语言的,但对于你的问题,刚开始觉得确实存在这样的问题,但想了一下觉得还是不成问题的,在JSP网页里,当看到% %里面包含的就是JAVA程序片,在它外面的就是一些JSP语法,HTML语句的往往是一些表格什么的,应该不难分辨的。
java程序定义抽象房间类room,类中包括房间号爱床位数是否有空调等成员变量,定义根据住宿天数计算
//1.定义抽象类Room
public abstract class Room {
//定义抽象方法
public void roomCost(int days){ };
}
//2.定义子类Single
public class Single extends Room {
private String bedNo;//定义属性床号
private Boolean isAirConditioning=true;//定义是否为空调房
private double roomPrice = 100.00;//定义非空调房基准价位属性
//计算房价方法
public void roomCost(int days){
//当是空调房进入if语句体,非空调房进入else语句体。
if(isAirConditioning){
roomPrice += days*10.00;
System.out.println("您的房间号为:"+getBedNo()+"号为空调房您的住宿费用如下:");
System.out.print(roomPrice);
System.out.print("人民币");
}else{
System.out.println("您的房间号为:"+getBedNo()+"号住宿费用如下:");
System.out.print(roomPrice);
System.out.print("人民币");
}
}
public String getBedNo() {
return bedNo;
}
public void setBedNo(String bedNo) {
this.bedNo = bedNo;
}
public double getRoomPrice() {
return roomPrice;
}
public void setRoomPrice(double roomPrice) {
this.roomPrice = roomPrice;
}
public static void main(String[] args) {
Single sg = new Single();
//给的房间为空调房
sg.isAirConditioning=true;
//给房间号值
sg.bedNo = "3102";
//执行房间计费方法
sg.roomCost(3);
}
}
本文标题:发布房屋信息java代码,房屋租赁java源代码
新闻来源:http://scjbc.cn/article/hdedgj.html