M
mara.aelene
I can't figure out why the mathematical calculations are not working
in this program. It should be taking the duracion (number of days)
times the cost of the unit. This is for a university class and I
could really use the help.... please!
import java.util.Scanner;
public class Prob2DOS
{
public static void main (String[] args)
{
String titlePage = "\tWelcome to Yellowstone National " +
"Park's Lodging Reservation System.\n\n" +
"To complete your reservation, pleae answer the following
questions.\n" +
"(After each entry, press the ENTER key. Enter only one value per
question.\n\n";
Scanner dosInput = new Scanner(System.in);
//Declaring Variables
String customerNameString;
String customerUnitString;
String customerDateString;
int customerDate = 99/99/9999;
String customerDuracionString;
int customerDuracion = 9;
String customerCostString;
double customerCost = 999;
String customerTotalString = "";
double customerTotal;
String continueString = "y";
//Produce the title information
System.out.println("\t\t\tYellowstone National Park Lodging
Reservation System" +
"\n\t\tThis program produced by: Mara Francis\n");
while (continueString.equalsIgnoreCase("y"))
{
//Prompt and get input from User
System.out.print("Your Name?");
customerNameString = dosInput.next();
System.out.print("Which unit do you wish to reserve?");
customerUnitString = dosInput.next();
System.out.print("Arrival date (format: MM/DD/YYYY)?");
customerDateString = dosInput.next();
System.out.print("What is the duracion of your stay?");
customerDuracionString = dosInput.next();
System.out.print("What is the cost of per-night rental?");
customerCostString = dosInput.next();
//Conversions
customerCost = Double.parseDouble(customerCostString);
//Calculations
customerTotal = Math.round(customerCost * customerDuracion);
//Output
System.out.print("\nReservation for " + customerNameString + "\nYou
have reserved " + customerUnitString + " for "
+ customerDuracionString + " beginning on " + customerDateString +
".");
System.out.print("\nYour total cost is: $" + customerTotal);
System.out.print("\nYour price is based on a per night rental of $"
+ customerCostString);
System.out.print("\nDo you wish to enter more data? (Y/N)");
continueString = dosInput.next();
}
}
}
in this program. It should be taking the duracion (number of days)
times the cost of the unit. This is for a university class and I
could really use the help.... please!
import java.util.Scanner;
public class Prob2DOS
{
public static void main (String[] args)
{
String titlePage = "\tWelcome to Yellowstone National " +
"Park's Lodging Reservation System.\n\n" +
"To complete your reservation, pleae answer the following
questions.\n" +
"(After each entry, press the ENTER key. Enter only one value per
question.\n\n";
Scanner dosInput = new Scanner(System.in);
//Declaring Variables
String customerNameString;
String customerUnitString;
String customerDateString;
int customerDate = 99/99/9999;
String customerDuracionString;
int customerDuracion = 9;
String customerCostString;
double customerCost = 999;
String customerTotalString = "";
double customerTotal;
String continueString = "y";
//Produce the title information
System.out.println("\t\t\tYellowstone National Park Lodging
Reservation System" +
"\n\t\tThis program produced by: Mara Francis\n");
while (continueString.equalsIgnoreCase("y"))
{
//Prompt and get input from User
System.out.print("Your Name?");
customerNameString = dosInput.next();
System.out.print("Which unit do you wish to reserve?");
customerUnitString = dosInput.next();
System.out.print("Arrival date (format: MM/DD/YYYY)?");
customerDateString = dosInput.next();
System.out.print("What is the duracion of your stay?");
customerDuracionString = dosInput.next();
System.out.print("What is the cost of per-night rental?");
customerCostString = dosInput.next();
//Conversions
customerCost = Double.parseDouble(customerCostString);
//Calculations
customerTotal = Math.round(customerCost * customerDuracion);
//Output
System.out.print("\nReservation for " + customerNameString + "\nYou
have reserved " + customerUnitString + " for "
+ customerDuracionString + " beginning on " + customerDateString +
".");
System.out.print("\nYour total cost is: $" + customerTotal);
System.out.print("\nYour price is based on a per night rental of $"
+ customerCostString);
System.out.print("\nDo you wish to enter more data? (Y/N)");
continueString = dosInput.next();
}
}
}