I am writing a program that determines the price to rent two different mopeds. The program will not compile and I'm not sure where to go from here.
The 50cc mopette is 15$ for the first 3 hours, and $2.50 an hour after the first 3 hours on a weekday. It is $30 for the first 3 hourse and $7.50 an hour after that on the weekend.
The 250cc mohawk is 25$ for the first 3 hours, and $3.50 an hour after the first 3 hours on a weekday. It is $35 for the first 3 hourse and $8.50 an hour after that on the weekend.
import java.text.*;
import java.util.*;
import java.lang.*;
class Ch5Pr21 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double moped, days, time;
System.out.println("Choose your moped: Enter 1 for 50cc Mopette or 2 for 250 cc Mohawk.");
double moped = scanner.next( );
System.out.println("Weekday or weekend: Enter 1 for weekday or 2 for weekend.");
double days = scanner.next( );
System.out.println("How many hours?");
double time = scanner.next( );
if (moped = 1) {
if (days = 1) {
if (time <= 3)
System.out.println("Cost is $15");
} else {
System.out.println("Cost is $" + (15+((time-3)*2.5)));
}
} else {
if (time <= 3) {
System.out.println("Cost is $30");
} else {
System.out.println("Cost is $" + (30+((time-3)*7.5)));
}
} else {
if (days = 1) {
if (time <= 3)
System.out.println("Cost is $25");
} else {
System.out.println("Cost is $" + (25+((time-3)*3.5)));
}
} else {
if (time <= 3)
System.out.println("Cost is $35");
} else {
System.out.println("Cost is $" + (35+((time-3)*8.5)));
}
}
}
}
}
}
