Results 1 to 5 of 5
Thread: personalizing instructions
- 02-02-2011, 01:26 AM #1
Member
- Join Date
- Jan 2011
- Posts
- 13
- Rep Power
- 0
personalizing instructions
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"
import java.util.*;
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();
- 02-02-2011, 01:53 AM #2
Member
- Join Date
- Jan 2011
- Posts
- 13
- Rep Power
- 0
nevermind I got it!
- 02-02-2011, 01:53 AM #3
Wow, that's terrible. What do you want us to do about it? Perhaps if you told us what error you got we might be able to help.but I get an error
Well you did store the users name in a variable so it is just a matter of adding the variable into the print statement. Try a see if you can do it yourself without me showing. Remember if you get an error post your code and the EXACT error message.For example I want it to say "(name) enter the make and model of your car"
- 02-02-2011, 02:23 AM #4
Member
- Join Date
- Jan 2011
- Posts
- 13
- Rep Power
- 0
I figured it out already. Thanks
- 02-02-2011, 02:35 AM #5
Similar Threads
-
Print image and send additional PCL instructions.
By bronai in forum Advanced JavaReplies: 1Last Post: 05-16-2011, 07:18 PM -
What code requires more machine level instructions? Why?
By abner80 in forum New To JavaReplies: 1Last Post: 03-21-2009, 05:46 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks