我正在为我的 CSE 20 课程做我的第一个项目,我必须编写一个简单的租车系统。我一开始就卡住了。我需要问车,# 天,然后你是否是俱乐部会员。如果您不是,代码需要继续并输出总数,它确实如此。但是,如果您是俱乐部会员,则必须询问有关行政一揽子计划的另一个问题,那么这会在总输出中增加另一条线。我不知道如何对其进行编码以完全运行。任何帮助,将不胜感激。
import java.util.Scanner;
public abstract class Bobcar1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner blah = new Scanner(System.in);
System.out.println("Available cars: 1 for Econobox, 2 for Compact, 3 for Standard");
System.out.print("Please choose the rental car: ");
int car;
car = blah.nextInt();
System.out.print("Please enter the number of rental days: ");
int day;
day = blah.nextInt();
System.out.print("Club member?: 1 for yes, 0 for no: ");
int re;
re = blah.nextInt();
if (re == 1)
System.out.print("Platinum Executive Package?: 1 for yes, 0 for no: ");
int pack;
pack = blah.nextInt();
if (re == 0) then what do i code here to get the program to run through completely?
if (car == 1) {
int car1;
car1 = (25 * day);
System.out.println("Base: " + day + " day(s) for a Econobox @ $25 per day: " + "+$" + car1);
if (pack == 0 && re == 0) {
System.out.println();
System.out.println("Total Estimate for Rental: " + " $" + car1);
}
if (re == 1 && pack == 0) {
int re1;
re1 = (day/5)*25;
System.out.println("Club Member Discount: " + "-$" + re1);
int total1r;
total1r = car1 - re1;
System.out.println();
System.out.println("Total Estimate for Rental: " + " $" + total1r);
}
if (pack == 1 && re == 1) {
int pack1;
pack1 = (int) (car1*.20);
System.out.println("Platinum Executive Package: " + "+$" + pack1);
int re1;
re1 = (day/5)*25;
System.out.println("Club Member Discount: " + "-$" + re1);
int total1;
total1 = car1 + pack1 - re1;
System.out.println("Total Estimate for Rental: " + " $" + total1);
}
}
if (car == 2) {
int car1;
car1 = (55 * day);
System.out.println("Base: " + day + " day(s) for a Compact @ $55 per day: " + "+$" + car1);
if (pack == 0 && re == 0) {
System.out.println();
System.out.println("Total Estimate for Rental: " + " $" + car1);
}
if (re == 1 && pack == 0) {
int re1;
re1 = (day/5)*55;
System.out.println("Club Member Discountt: " + "-$" + re1);
int total1r;
total1r = car1 - re1;
System.out.println();
System.out.println("Total Estimate for Rental: " + " $" + total1r);
}
if (pack == 1 && re == 1) {
int pack1;
pack1 = (int) (car1* .20);
System.out.println("Platinum Executive Package: " + "+$" + pack1);
int re1;
re1 = (day/5)*55;
System.out.println("Club Member Discount: " + "-$" + re1);
int total1;
total1 = car1 + pack1 - re1;
System.out.println("Total Estimate for Rental: " + " $" + total1);
}
}
if (car == 3) {
int car1;
car1 = (100 * day);
System.out.println("Base: " + day + " day(s) for a Standard @ $100 per day: " + "+$" + car1);
if (pack == 0 && re == 0) {
System.out.println();
System.out.println("Total Estimate for Rental: " + " $" + car1);
}
if (re == 1 && pack == 0) {
int re1;
re1 = (day/5)*100;
System.out.println("Return Customer Discount: " + "-$" + re1);
int total1r;
total1r = car1 - re1;
System.out.println();
System.out.println("Total Estimate for Rental: " + " $" + total1r);
}
if (pack == 1 && re == 1) {
int pack1;
pack1 = (int) (car1*.20);
System.out.println("Platinum Executive Package: " + "+$" + pack1);
int re1;
re1 = (day/5)*100;
System.out.println("Club Member Discount: " + "-$" + re1);
int total1;
total1 = car1 + pack1 - re1;
System.out.println("Total Estimate for Rental: " + " $" + total1);
}
}}}}