Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Update this program. The instructional changes begin with // Programing Logic an

ID: 3764194 • Letter: U

Question

Update this program. The instructional changes begin with //

Programing Logic and Design Introductory Joyce Farrell 8th Edition

// This program accepts any number of purchase prices

// and computes state sales tax as 6% of the value

// and city sales tax as 2% of the value

// Modify the program so that the user enters

// the two tax rates

// at the start of the program

start

   Declarations

      num price

      num STATE_TAX_RATE = 0.06

      num CITY_TAX_RATE = 0.02

      num totalTax

      num total

   startUp()

   while price not equal to 0

      mainLoop()

   endwhile

   finishUp()

stop

startUp()

   output "Enter a price or 0 to quit"

   input price

return

mainLoop()

   totalTax = price * STATE_TAX_RATE + price * CITY_TAX_RATE

   total = price + totalTax

   output "Price is " , price, " and total tax is ", totalTax

   output "Total is ", total

   output "Enter a price or 0 to quit"

   input price

return

finishUp()

   output "End of program"

return

Explanation / Answer

Answer :

import java.util.*;
class ProgramTax
{
   static int price;
  
   static double STATE_TAX_RATE = 0.06;
   static double CITY_TAX_RATE = 0.02;
   static double totalTax;
   static double total;
   public static void main(String args[])
   {
      
       //double STATE_TAX_RATE = 0.06;
       //double CITY_TAX_RATE = 0.02;
      
       startup();
       while(price!=0)
       {

           price=mainloop();
      
       }
  


   }
   static void startup()
   {
       Scanner sc= new Scanner(System.in);
       System.out.println("Enter 0 to quit and other value to proceed : ");
       int k= sc.nextInt();
      
      
       int ch=k;
      
       switch(ch)
       {
           case 0:
               System.exit(0);
           break;
           default:
           Scanner keyboard = new Scanner(System.in);
       System.out.println("Enter Price value :");
       price= keyboard.nextInt();
           break;
       }
              
   }
   static void finshup()
   {
       System.out.println("End Of The Program");
       System.exit(0);

   }
   static int mainloop()
   {
       totalTax = price * STATE_TAX_RATE + price * CITY_TAX_RATE;
        total = price + totalTax;
        System.out.println("Price is "+price+" and total tax is "+totalTax);
        System.out.println("Total is "+total);
        Scanner scan= new Scanner(System.in);
       System.out.println("Enter Price value or 0 to quit");
       int p= scan.nextInt();
       if(p==0)
       finshup();
       return p;
      
       


   }
      
      


}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote