So I'm super confused and just looking for help :L. This is what the instructions from my instructor were.
Instructions : Use a sentinel value loop.
Ask each user for: •Type of vehicle (May use something other than strings, such as: 1 for economy, 2 for sedan, etc.) •Days rented
Calculate the (For each customer): •Rental cost, •Taxes, •Total Due. There are three different rental options with seprate rates: Economy @ 31.76, sedan @ 40.32, SUV @ 47.56. [Note: only whole day units to be considered (no hourly rates)].
Sales tax is = to 6% on the TOTAL.
Create summary data with: •Number of customers •Total money collected. Also, Include IPO, algorithm, and desk check values (design documents).
{WHAT I HAVE GOING AND MY QUESTION}
package yipe;
public class Umm {
import java.util.*;
int count = 0;
static int CarType, days;
static double DailyFee, Total;
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
System.out.print("What vehical would you like to rent?\n");
System.out.println("Enter 1 for an economy car\n");
System.out.println("Enter 2 for a sedan car\n");
System.out.println("Enter 3 for an SUV");
CarType = keyboard.nextInt();
if (CarType == '1')
DailyFee=(int)31.76;
else if(CarType == '2')
DailyFee=(int)40.32;
else if(CarType == '3')
DailyFee=(int)43.50;
System.out.print("Please enter the number of days rented. (Example; 3) : ");
days = keyboard.nextInt();
Total = (DailyFee * days * 6/100);
System.out.printf("The total amount due is $" + Total);
}
}
- How can I fix my IF statement(s) to get proper math results?
- how would I make it loop for to put in multiple information??
- how to make summary data?
Aucun commentaire:
Enregistrer un commentaire