Click here to Skip to main content
15,920,602 members
Home / Discussions / Java
   

Java

 
AnswerRe: how to make user interface in java. Pin
fly90421-Mar-09 2:09
fly90421-Mar-09 2:09 
QuestionWhat's your advice ? Pin
Mohammad Dayyan20-Mar-09 18:03
Mohammad Dayyan20-Mar-09 18:03 
AnswerRe: What's your advice ? Pin
N a v a n e e t h20-Mar-09 19:03
N a v a n e e t h20-Mar-09 19:03 
GeneralRe: What's your advice ? Pin
Mohammad Dayyan20-Mar-09 19:09
Mohammad Dayyan20-Mar-09 19:09 
AnswerRe: What's your advice ? Pin
jschell1-Apr-09 15:02
jschell1-Apr-09 15:02 
Questioncubic equation in java Pin
vikss20-Mar-09 11:17
vikss20-Mar-09 11:17 
AnswerRe: cubic equation in java Pin
fly90420-Mar-09 11:45
fly90420-Mar-09 11:45 
Questionjava..looping.... Pin
vitaminwater2219-Mar-09 21:23
vitaminwater2219-Mar-09 21:23 
import java.util.Scanner; /* Import the Java Scanner class to get input entered at the keyboard. */


{{ public class


public static void main(String[] args);

final double TAX_RATE = .1025;
final double COMM_RATE = .02;
final double DISC_PCT1 = .28;
final double DISC_PCT2 = .21;
final double DISC_PCT3 = .14;
final double DISC_PCT4 = .07;
final double DISC_LEVEL_1 = 50000.00;
final double DISC_LEVEL_2 = 49999.00;
final double DISC_LEVEL_3 = 39999.00;
final double DISC_LEVEL_4 = 34999.00;

/* This is where you will define constants for tax rate of 10.25% and dealer commission of 2%.*/




/* This where you will define the additional variables necessary. One integer has already been defined for you. */


int carYear,
carMileage;


double carCost,
salesTax,
dealerCommission,
totalCost,
discount;

/* This integer variable holds the model year of the car. */



/* The following declares an instance, or object, of the Scanner class to get keyboard input. */


Scanner scan = new Scanner(System.in);



/* <1> Prompt for and get the car's model year. */



System.out.print("\nPlease enter the car's model year: ");



carYear = scan.nextInt();


/* <2> Prompt for and get the car's mileage. */


System.out.print ("\nPlease enter the car's mileage; ");


carMileage = scan.nextInt ();


/* <3> Prompt for and get the car's list price. */


System.out.print ("\nPlease enter the car's list price; ");


carCost = scan.nextDouble();


/* <4> Compute the sales tax for the sale of the car. */


salesTax = carCost * TAX_RATE;

/*Determine discount rate*/

if(carCost>= DISC_LEVEL_1)
discount = carCost * DISC_PCT1;
else if (carCost>= DISC_LEVEL_2)
discount = carCost * DISC_PCT2;
else if (carCost>= DISC_LEVEL_3)
discount = carCost * DISC_PCT3;
else if (carCost>= DISC_LEVEL_4)
discount = carCost * DISC_PCT4;
else discount = 0;


/* <5> Compute the dealer's commission for the sale of the car. */

dealerCommission = (carCost - discount) * COMM_RATE;

dealerCommission = carCost * COMM_RATE;


/* <6> Compute the total cost, including tax, for the sale of the car. */


totalCost = carCost + salesTax;


/* <7> Print program header message. */


System.out.print("\n\n Northern Illinois Used Cars");
System.out.print("\n*************************************");
System.out.print("\n Cost of a Used Car");
System.out.print("\n*************************************\n");

/* <8> Print the report lines. */

do
}


System.out.printf ("\n Car's Model Year: %5d", carYear);

System.out.printf ("\n Car Mileage: %7d miles", carMileage);

System.out.printf ("\n Car's List Price: %10.2f dollars", carCost);

System.out.printf ("\n Sales Tax: %10.2f dollars" ,salesTax);

System.out.printf ("\n Total Cost: %10.2f dollars\n\n", totalCost);

System.out.printf ("\n\n Discount %10.2f dollars", discount);

System.out.printf ("\n\n Dealer's Commission: %10.2f dollars", dealerCommission);


System.out.print("\n\nWould you like to loop? Enter '1' for yes: ");

choice = keyScan.nextInt();

{while(choice==1);








}


i cannot get this program to work... i know there are mistakes but i cannnot fix them....
AnswerRe: java..looping.... Pin
Cedric Moonen19-Mar-09 22:33
Cedric Moonen19-Mar-09 22:33 
AnswerRe: java..looping.... Pin
fly90419-Mar-09 23:57
fly90419-Mar-09 23:57 
GeneralRe: java..looping.... Pin
Nagy Vilmos20-Mar-09 10:30
professionalNagy Vilmos20-Mar-09 10:30 
GeneralRe: java..looping.... Pin
fly90420-Mar-09 11:43
fly90420-Mar-09 11:43 
Generalcode and srs for project of website development in java Pin
bindlas601719-Mar-09 18:21
bindlas601719-Mar-09 18:21 
GeneralRe: code and srs for project of website development in java Pin
Cedric Moonen19-Mar-09 22:34
Cedric Moonen19-Mar-09 22:34 
QuestionAsync networking in java Pin
Jim Crafton18-Mar-09 5:45
Jim Crafton18-Mar-09 5:45 
AnswerRe: Async networking in java Pin
Nagy Vilmos18-Mar-09 23:28
professionalNagy Vilmos18-Mar-09 23:28 
QuestionJCombobox in JTable Pin
vinothrm16-Mar-09 23:30
vinothrm16-Mar-09 23:30 
AnswerRe: JCombobox in JTable Pin
TorstenH.17-Mar-09 5:05
TorstenH.17-Mar-09 5:05 
Question[Message Deleted] Pin
vinothrm16-Mar-09 23:11
vinothrm16-Mar-09 23:11 
AnswerRe: access .net and java Pin
fly90416-Mar-09 23:18
fly90416-Mar-09 23:18 
GeneralRe: access .net and java Pin
vinothrm16-Mar-09 23:21
vinothrm16-Mar-09 23:21 
Questionimage processing Pin
sudipkumar0316-Mar-09 20:10
sudipkumar0316-Mar-09 20:10 
AnswerRe: image processing Pin
fly90416-Mar-09 23:15
fly90416-Mar-09 23:15 
Questionwhat is the use of String tokenizer? Pin
akosidandan16-Mar-09 20:01
akosidandan16-Mar-09 20:01 
AnswerRe: what is the use of String tokenizer? Pin
fly90416-Mar-09 23:17
fly90416-Mar-09 23:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.