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

Based on the program that I wrote, can you help me to modify it so it does the f

ID: 650347 • Letter: B

Question

Based on the program that I wrote, can you help me to modify it so it does the following:

import java.util.Scanner;
public class furnitureStore
{
   public static void main(String[] args)
   {
  
Scanner input = new Scanner(System.in);
float cost,price=0,tax;
int woodType;
final int PINE_CODE = 1;
   final int OAK_CODE = 2;
final int MAHOGANY_CODE = 3;
;
String message = "NO MESSSAGE ASSGINED";
  
int tableSize;
String volunteer = "INVALID SIZE CHOICE! It will be automatically assigned as SMALL SIZE without additional charge.";
  
   final int LARGE_SIZE = 1;
final int SMALL_SIZE = 2;
  
final String largeSize = "LARGE";
final String smallSize = "SMALL";

System.out.println(" Steven's Furniture Shop");
System.out.println(" -------Pine, Oak, Mahogany Tables-------");
System.out.println("1 for Pine Table $100");
System.out.println("2 for Oak Table $225");
System.out.println("3 for Mahogany Table $310");
System.out.println("0 to Exit program ");
System.out.println("Enter now ----->");
woodType=input.nextInt();
System.out.println("Enter (1) for a large size and (2) for a small size:");
tableSize=input.nextInt();

switch(woodType)
{

   case 1:
price=100;
message ="This table type is PINE";
break;
  
   case 2:
price=215;
message ="This table type is OAK";
break;
   case 3:
price=310;
message ="This table type is MAHOGANY";
break;
   case 0:
System.exit(0);
break;
   default:
message = " You did not enter a 0,1,2 or 3. Try again" ;
price=0;
break;
}
  
   if (tableSize == LARGE_SIZE)
{
   volunteer = largeSize;
   price=price+35;

}
else if (tableSize == SMALL_SIZE)
{
   volunteer = smallSize;
}

else

   {
   System.out.println("Invalid Choice");
}
tax=price*((float)6/(float)100);
cost=price+tax;
System.out.println(message);
System.out.println("Table size Large (1) or Small (2):" + volunteer);
System.out.println("Subtotal $" + price);
System.out.println("Tax: $" + tax);
System.out.println("Total $" + cost);

   }
}

Explanation / Answer

import java.util.Scanner;
import java.math.BigDecimal;
import java.math.MathContext;
public class HelloWorld
{
public static void main(String[] args)
{
  
Scanner input = new Scanner(System.in);
float cost,price=0,tax;
int woodType;
final int PINE_CODE = 1;
final int OAK_CODE = 2;
final int MAHOGANY_CODE = 3;
;
String message = "NO MESSSAGE ASSGINED";
String tableSize;
String volunteer = "INVALID SIZE CHOICE! It will be automatically assigned as SMALL SIZE without additional charge.";
  
final int LARGE_SIZE = 1;
final int SMALL_SIZE = 2;
  
final String largeSize = "LARGE";
final String smallSize = "SMALL";

System.out.println(" Tu's Furniture Shop");
System.out.println(" -------Pine, Oak, Mahogany Tables-------");
System.out.println("1 for Pine Table $100");
System.out.println("2 for Oak Table $225");
System.out.println("3 for Mahogany Table $310");
System.out.println("0 to Exit program ");
System.out.println("Enter now ----->");
woodType=input.nextInt();
System.out.println("Enter (1) for a large size and (2) for a small size:");
tableSize=input.nextInt();

switch(woodType)
{

case 1:
price=100;
message ="This table type is PINE";
break;
  
case 2:
price=215;
message ="This table type is OAK";
break;
case 3:
price=310;
message ="This table type is MAHOGANY";
break;
case 0:
System.exit(0);
break;
default:
message = " You did not enter a 0,1,2 or 3. Try again" ;
price=0;
break;
}
if (tableSize == LARGE_SIZE)
{
volunteer = largeSize;
price=price+35;
}
else if (tableSize == SMALL_SIZE)
{
volunteer = smallSize;
}
else
{
System.out.println("Invalid Choice");
}
tax=price*((float)6/(float)100);
cost=price+tax;
System.out.println(message);
System.out.println("Table size Large (1) or Small (2):" + volunteer);
System.out.println("Subtotal $" + price);
System.out.println("Tax: $" + tax);
System.out.println("Total $" + cost);

}
}

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