ok im in an entry level class and very new to java so your help would be greatly appreciated..here is what were supposed to do...
Write a program to take bids for an auction business. The program prompts the user to enter the name of item desired, next prompts the user to enter the bid price, next prompt the user to enter the desired method of shipping. There are three shipping methods available. ( 0 means ground shipping four day delivery, 1 means ground express two day delivery, 2 means air shipping one day delivery ). No charge for ground four day delivery, there is a $5.00 charge for ground express and $15.00 charge for air shipping ). Assume that the user of the program will be perfectly alert and a perfect typist, will not make any mental or typing mistakes.
A sample run would look like this :
Enter Item you are bidding on : bicycle
Enter your bid price : 50.00
Enter desired delivery method ( 0 for ground four day, 1 for ground express, 2 for air shipping ) : 1
Invoice :
Item : Bicycle
Your bid price : 50.00
shipping : 5.00
total : 55.00
here is my program so far...
import java.util.Scanner;
public class Assign4_Roberts{
public static void main(String[] args){
//enter shipping prices
double ground = 0;
double express = 5;
double air = 15;
//create a scanner
Scanner input = new Scanner(System.in);
System.out.println("Enter the item you are bidding on :");
int answer =input.nextInt();
System.out.println("Enter your maximum bid: ");
int num = input.nextInt();
System.out.println("Enter desired delivery method ( 0 for ground four day, 1 for ground express, 2 for air shipping ) :");
int shipping = input.nextInt();
if(shipping == 0)
System.out.println("total:" + num + ground);
if(shipping == 1)
System.out.println("total:" + num + express);
if(shipping == 2)
System.out.println("total:" + num + air);
//invoice
System.out.println("Invoice :");
System.out.println("Item :" + answer);
System.out.println("Your Bid Price :" + num);
System.out.println("Total :" + num + shipping);
}
}[B][/B]
and here is what happens when i try to run the program...im using eclipse btw
Enter the item you are bidding on :
bicycle
Exception in thread "main" java.util.InputMismatchException
at java.util.Scanner.throwFor(Unknown Source)
at java.util.Scanner.next(Unknown Source)
at java.util.Scanner.nextInt(Unknown Source)
at java.util.Scanner.nextInt(Unknown Source)
at Assign4_Roberts.main(Assign4_Roberts.java:20)
anybody know what im doing wrong