Im a beginner programmer and im trying to complete this assignment but i need Help.
In this lab you have a prewritten Java program for a furniture company. The program is supposed to compute the price of any table a customer orders, based on the following facts:
The charge for all tables ia minimum of $150.00
If the surface(length * width) is over 750 square inches, add $50.00
If the wood is "mahogany" add $200.00; for "oak" add $100.00. No charge is added for "pine"
For extension leaves for the table, there is an additional $50.00 charge each.
You need to declare variables for the following, and initialize them where specified:
A Variable for the cost of the table initialized to 0.00
A variable for the length of the table initialized to 50 inches
A variable for the width of the table initialized to 40 inches
A variable for the surface area of the table
A variable for the wood type initialized with the value "oak"
A variable for the number of extension leaves initialized with the value 2.
Write the rest of the program using assignments statement and if statements as appropriate. The out statement is written for you. Your output should be: The charge for this table is $400.0.
This is what i have
public class Furniture { public static void main(String args[]) { // Declare and initialize variables here. // Charge for this table. double charge = 150.00; double table = 0.00; // Length of table in inches. int length = 50; // Width of table in inches. int width = 40; // Area of this table in square inches. int area = length * width; // Type of wood. String wood = oak; // Number of extension leaves. int leaves = 2; // Write assignment and if statements here as appropriate. table = 0.00; if (area > 750) {charge += 50;} if (wood = "mahogany") {charge += 200.00;} if (wood = "oak") {charge += 100.00;} // Output Charge for this table. System.out.println("The charge for this table is $" + charge); System.exit(0); } }
Can you tell me what i need to add or delete rather than just writing it out. But if you do write if out can you explain it please.