Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Homework1 {
- public static void main (String [] Args) {
- Scanner read = new Scanner (System.in);
- /*
- NOTES:
- "l" is length
- "w" is width
- "stotal" is the sum of price and area
- "total" is the sum of all rooms
- Credits to: Mamoun Salim Nabulsi #11717207
- */
- float l1, l2, l3, w1, w2, w3, area1, area2, area3;
- float price1, price2, price3;
- float stotal1, stotal2, stotal3;
- float total;
- System.out.println("Please enter the length and width of room number one");
- System.out.println("Length:");
- l1 = read.nextFloat();
- System.out.println("Width:");
- w1 = read.nextFloat();
- System.out.println("Please enter the price per meter squared");
- price1 = read.nextFloat();
- area1 = (l1 * w1);
- stotal1 = (price1 * area1);
- System.out.println("Please enter the length and width of room number one");
- System.out.println("Length:");
- l2 = read.nextFloat();
- System.out.println("Width:");
- w2 = read.nextFloat();
- System.out.println("Please enter the price per meter squared");
- price2 = read.nextFloat();
- area2 = (l2*w2);
- stotal2 = (price2 * area2);
- System.out.println("Last step. Kindly, enter the length and width of room number one");
- System.out.println("Length:");
- l3 = read.nextFloat();
- System.out.println("Width:");
- w3 = read.nextFloat();
- System.out.println("Please enter the price per meter squared");
- price3 = read.nextFloat();
- area3 = (l3*w3);
- stotal3 = (price3 * area3);
- total = (stotal1 + stotal2 + stotal3);
- System.out.println("Room #\t Length\t Width\t Area\t Price per meter\t Total");
- System.out.println("--------------------------------------------------------------");
- System.out.println("Room #1\t" +l1+"\t" +w1+"\t" +area1+"\t"+price1+ "\t"+stotal1);
- System.out.println("Room #2\t" +l2+"\t" +w2+"\t" +area2+"\t"+price2+"\t"+stotal2);
- System.out.println("Room #3\t" +l3+"\t" +w3+"\t" +area3+"\t"+price3+"\t"+stotal3);
- System.out.println(" Sub Total:"+total);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement