looping....

Looping problems

  • (2 Pages)
  • +
  • 1
  • 2

26 Replies - 811 Views - Last Post: 20 March 2009 - 05:36 PM Rate Topic: -----

#1 VitaminWater22  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 32
  • Joined: 19-March 09

looping....

Post icon  Posted 20 March 2009 - 12:15 AM


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);
			   
					   
			   
			  
	 

		
   
		}







ok, here is what i have but there are many mistakes in it and i cannot figure them out for the life of me....

Is This A Good Question/Topic? 0
  • +

Replies To: looping....

#2 jarosser06  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 22-January 08

Re: looping....

Posted 20 March 2009 - 01:34 AM

View PostVitaminWater22, on 19 Mar, 2009 - 11:15 PM, said:


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);
			   
					   
			   
			  
	 

		
   
		}







ok, here is what i have but there are many mistakes in it and i cannot figure them out for the life of me....


Just glancing at the code i see quite a few syntactical errors like using "{" instead of "}" you didn't name the class at the beginning you have two brackets before the class header which should come after the class header. I would suggest going through and making sure all of your brackets are in order first and check to make sure you aren't missing any semicolons. Once you fix that ill be able to help you a little more.

Edit:
After making a few changes with brackets the program works but you are going need to move your questions into the do while loop assuming the program is supposed to ask the questions every time you loop. Right now it just prints out the answers.

This post has been edited by jarosser06: 20 March 2009 - 01:53 AM

Was This Post Helpful? 0
  • +
  • -

#3 VitaminWater22  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 32
  • Joined: 19-March 09

Re: looping....

Posted 20 March 2009 - 12:49 PM


import java.util.Scanner;   /* Import the Java Scanner class to get input entered at the keyboard. */


public class asgn5
{
	

			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,
			   	   		carcounter = 0,
			   	   		count = 0,
			   	   		choice;
			   	   
			   	   
			   double   carCost,
			   			carPrice,
			   			discount = 0,
			   			dealerCommission = 0,
			   			salesTax,
			   			totaldealercommission = 0,
			   			totalCost,
			   			TotalcarPrice,
			   			combinedcarcost = 0,
			   			totaldiscount = 0,	
			   			totalsalesTax = 0,			   
						totalcomission = 0,
						totalTotalcarPrice = 0,
						totalSalesTax = 0,
						totalPriceWithTax = 0,
						Pricewithtax;
			   			   
			 	/* 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);
			   
			   
			   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");
			   
			  do
			  {
				  
			   count++;
			   
						
			   /* <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;
			   
			   totaldiscount = totaldiscount + discount;
							   
			   	totalSalesTax = totalSalesTax + salesTax;
			
			 	Pricewithtax = carCost + salesTax;
			
				totalPriceWithTax = totalPriceWithTax + Pricewithtax;
				
				totaldealercommission = totaldealercommission = dealerCommission;
				
				totalCost  = carCost +  salesTax;
				
				combinedcarcost = combinedcarcost + carCost;
				
				
			   
			   /*Determine discount rate*/
			   
			   if(carCost>= DISC_LEVEL_4)
					discount = carCost * DISC_PCT4;
			   else if (carCost>= DISC_LEVEL_3)
			   		discount = carCost * DISC_PCT3;
			   else if (carCost>= DISC_LEVEL_2)
			   		discount = carCost * DISC_PCT2;
			   else if (carCost>= DISC_LEVEL_1)
			   	 	discount = carCost * DISC_PCT1;
			   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. */
				
	 
				 Pricewithtax  = carCost +  salesTax; 
		
	 
			   /* <7> Print program header message. */
		
	 
			
			   /* <8> Print the report lines.*/
		
			  
			   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 = scan.nextInt();
			   }	  
			   while(choice==1);
									 
			   
			   
			   System.out.printf("\n   Number of Items:	%5d\n", count);
			   System.out.printf("\n   Total discount : %10.2f dollars", totaldiscount);
			   System.out.printf("\n   Total Sales Tax: %10.2f dollars", totalSalesTax);
			   System.out.printf("\n	   Total Price: %10.2f dollars", combinedcarcost);
			   System.out.printf("\n\nAverage Price Paid: %10.2f dollars\n\n", totalPriceWithTax / count);
			   
			   System.out.printf("\n Total Dealer Comission:  %10.2f dollars", totaldealercommission);
			  
					   
	   } 
			  
}




Im having a problem with the total dealer commission adding together after the loop.... like everything else gives a total..but the total dealer commission will just go off the first cars commission...
Was This Post Helpful? 0
  • +
  • -

#4 VitaminWater22  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 32
  • Joined: 19-March 09

Re: looping....

Posted 20 March 2009 - 01:07 PM

any one got a suggestion???
Was This Post Helpful? 0
  • +
  • -

#5 Locke  Icon User is offline

  • Sarcasm Extraordinaire!
  • member icon

Reputation: 516
  • View blog
  • Posts: 5,588
  • Joined: 20-March 08

Re: looping....

Posted 20 March 2009 - 01:09 PM

No wonder it's only using the first car value, you're not using the combinedcarcost variable anywhere in the calculation of the dealer's commission.
Was This Post Helpful? 0
  • +
  • -

#6 VitaminWater22  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 32
  • Joined: 19-March 09

Re: looping....

Posted 20 March 2009 - 01:17 PM

so...where would i throw that in at???
Was This Post Helpful? 0
  • +
  • -

#7 Locke  Icon User is offline

  • Sarcasm Extraordinaire!
  • member icon

Reputation: 516
  • View blog
  • Posts: 5,588
  • Joined: 20-March 08

Re: looping....

Posted 20 March 2009 - 01:20 PM

I'm not entirely sure, since you have 1 calculation statement that is not doing anything.

dealerComission = (carCost - discount) * COMM_RATE;

dealerCommission = carCost * COMM_RATE;


Which is it? The second one is the only one that is actually happening, since the first one is being overriden by it.

This post has been edited by Locke: 20 March 2009 - 01:22 PM

Was This Post Helpful? 0
  • +
  • -

#8 VitaminWater22  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 32
  • Joined: 19-March 09

Re: looping....

Posted 20 March 2009 - 01:31 PM

i believe it is the second one i have to compute sales tax and dealer commission AFTER subtracting the discount if eligible for discount.....
Was This Post Helpful? 0
  • +
  • -

#9 Fuzzyness  Icon User is offline

  • Comp Sci Student
  • member icon

Reputation: 669
  • View blog
  • Posts: 2,438
  • Joined: 06-March 09

Re: looping....

Posted 20 March 2009 - 01:45 PM

if(discount>0)
dealerComission = (carCost - discount) * COMM_RATE;
else dealerCommission = carCost * COMM_RATE;



That way it uses the appropriate equation.
Was This Post Helpful? 0
  • +
  • -

#10 VitaminWater22  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 32
  • Joined: 19-March 09

Re: looping....

Posted 20 March 2009 - 01:57 PM

public class asgn5.java
{

and at the the bottom it says that there should be a { expected on the line with public class asgn5.java??? i tried adding one it does not fix it

public class asgn5.java
{

and at the the bottom it says that there should be a { expected on the line with public class asgn5.java??? i tried adding one it does not fix it
Was This Post Helpful? 0
  • +
  • -

#11 Locke  Icon User is offline

  • Sarcasm Extraordinaire!
  • member icon

Reputation: 516
  • View blog
  • Posts: 5,588
  • Joined: 20-March 08

Re: looping....

Posted 20 March 2009 - 01:57 PM

View PostFuzzyness, on 20 Mar, 2009 - 02:45 PM, said:

if(discount>0)
dealerComission = (carCost - discount) * COMM_RATE;
else dealerCommission = carCost * COMM_RATE;



That way it uses the appropriate equation.


Why would it matter? Just use the first one, because even if the discount is zero, it will calculate it correctly...

This post has been edited by Locke: 20 March 2009 - 01:58 PM

Was This Post Helpful? 0
  • +
  • -

#12 VitaminWater22  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 32
  • Joined: 19-March 09

Re: looping....

Posted 20 March 2009 - 02:06 PM


mport java.util.Scanner;   /* Import the Java Scanner class to get input entered at the keyboard. */


public class asgn5.java
{

	

			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,
			   	   		carcounter = 0,
			   	   		count = 0,
			   	   		choice;
			   	   
			   	   
			   double   carCost,
			   			carPrice,
			   			discount = 0,
			   			dealerCommission = 0,
			   			salesTax,
			   			totaldealercommission = 0,
			   			totalCost,
			   			TotalcarPrice,
			   			combinedcarcost = 0,
			   			totaldiscount = 0,	
			   			totalsalesTax = 0,			   
						totalcomission = 0,
						totalTotalcarPrice = 0,
						totalSalesTax = 0,
						totalPriceWithTax = 0,
						Pricewithtax;
			   			   
			 	/* 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);
			   
			   
			   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");
			   
			  do
			  {
				  
			   count++;
			   
						
			   /* <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;
			   
			   totaldiscount = totaldiscount + discount;
							   
			   	totalSalesTax = totalSalesTax + salesTax;
			
			 	Pricewithtax = carCost + salesTax;
			
				totalPriceWithTax = totalPriceWithTax + Pricewithtax;
				
				totaldealercommission = totaldealercommission = dealerCommission;
				
				totalCost  = carCost +  salesTax;
				
				combinedcarcost = combinedcarcost + carCost;
				
				
			   
			   /*Determine discount rate*/
			   
			   if(carCost>= DISC_LEVEL_4)
					discount = carCost * DISC_PCT4;
			   else if (carCost>= DISC_LEVEL_3)
			   		discount = carCost * DISC_PCT3;
			   else if (carCost>= DISC_LEVEL_2)
			   		discount = carCost * DISC_PCT2;
			   else if (carCost>= DISC_LEVEL_1)
			   	 	discount = carCost * DISC_PCT1;
			   else discount = 0;			
								
					   
			   /* <5> Compute the dealer's commission for the sale of the car. */
	 
			   dealerCommission = (carCost - discount) * COMM_RATE;
			   
			   dealerCommission = carCost * COMM_RATE;
			   
			   
			   if(discount>0)
			   dealerComission = (carCost - discount) * COMM_RATE;
			   else dealerCommission = carCost * COMM_RATE;

						
	 
			   /* <6> Compute the total cost, including tax, for the sale of the car. */
				
	 
				 Pricewithtax  = carCost +  salesTax; 
		
	 
			   /* <7> Print program header message. */
		
	 
			
			   /* <8> Print the report lines.*/
		
			  
			   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 = scan.nextInt();
			   }	  
			   while(choice==1);
									 
			   
			   
			   System.out.printf("\n   Number of Items:	%5d\n", count);
			   System.out.printf("\n   Total discount : %10.2f dollars", totaldiscount);
			   System.out.printf("\n   Total Sales Tax: %10.2f dollars", totalSalesTax);
			   System.out.printf("\n	   Total Price: %10.2f dollars", combinedcarcost);
			   System.out.printf("\n\nAverage Price Paid: %10.2f dollars\n\n", totalPriceWithTax / count);
			   
			   System.out.printf("\n Total Dealer Comission:  %10.2f dollars", totaldealercommission);
			  
					   
	   } 
			  
}







All is good..but when i run it it does not go...it just a mess and the only error that i have is.....

'{' expected


and this states its at the top on this line

public class asgn5.java
{


?????
Was This Post Helpful? 0
  • +
  • -

#13 Fuzzyness  Icon User is offline

  • Comp Sci Student
  • member icon

Reputation: 669
  • View blog
  • Posts: 2,438
  • Joined: 06-March 09

Re: looping....

Posted 20 March 2009 - 02:10 PM

Is the file name asgn5.java? or just asgn5?
you dont add the .java part. and class name has to match the file name
Was This Post Helpful? 0
  • +
  • -

#14 Locke  Icon User is offline

  • Sarcasm Extraordinaire!
  • member icon

Reputation: 516
  • View blog
  • Posts: 5,588
  • Joined: 20-March 08

Re: looping....

Posted 20 March 2009 - 02:16 PM

It should just be...

public class asgn5


The .java should not be there.

This post has been edited by Locke: 20 March 2009 - 02:16 PM

Was This Post Helpful? 0
  • +
  • -

#15 VitaminWater22  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 32
  • Joined: 19-March 09

Re: looping....

Posted 20 March 2009 - 02:17 PM

i am still not getting the dealers commission to add up....it just takes the first comission and prints it out as the total commission...
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2