I'm writing a program that prompts the user to enter information about their car in order to calculate various costs.
I already prompted the user to enter their name, but I also want the other prompts to include their name so it's more personalized.
I tried different ways but I get an error, please help!:eek:
Here's a piece of my program...
For example I want it to say "(name) enter the make and model of your car"
public class CarCosts
public static void main(String args)
Scanner keys=new Scanner(System.in);
System.out.println("Welcome, this program will determine the cost of owning and operating your car for the number of years you are in college.");
System.out.println("Please enter your name: ");
String firstName = keys.next();
System.out.println("Enter the make and model of your car: ");
String carModel = keys.next();
System.out.println("Enter the price of your car: ");
double initialPrice = keys.nextDouble();