Question: I'm working on Java progamming Project. The work blow is what I have done so far. I cannot make to show Amount of Shade and

I'm working on Java progamming Project. The work blow is what I have done so far. I cannot make to show Amount of Shade and BTU per Hour. And I have to put spaces between each information like text file.

1 import java.io.*; 2 import java.util.*; 3 4 public class Project 5 { 6 public static void main(String[] args) throws IOException 7 { 8 File file = new File("Rooms.txt"); 9 Scanner inputFile = new Scanner(file); 10 11 String room; 12 double length, width; 13 int shade; 14 double area; 15 String shadeAmount =""; 16 double BTU = 0; 17 double high_BTU = 0; double low_BTU = 100000; 18 String high_ROOM = ""; String low_ROOM = ""; 19 20 showTitle(); 21 22 while(inputFile.hasNext()) 23 { 24 room = inputFile.nextLine(); 25 length = inputFile.nextDouble(); 26 width =inputFile.nextDouble(); 27 shade = inputFile.nextInt(); 28 inputFile.nextLine(); 29 if(inputFile.hasNext()) 30 { 31 inputFile.nextLine(); 32 } 33 34 area = calculateArea(length, width); 35 36 translateShadeChoiceToString(shade, shadeAmount); 37 38 calculateBTUsPerHour(area, shade, BTU); 39 40 displayRoomInformation(room, area, shadeAmount, BTU); 41 42 if(BTU > high_BTU) 43 { 44 high_BTU = BTU; 45 high_ROOM = room; 46 } 47 else 48 { 49 low_BTU = BTU; 50 low_ROOM = room; 51 } 52 53 } 54 55 inputFile.close(); 56 57 58 System.out.println("Room that requires highest BTUs per Hour: " + high_ROOM); 59 System.out.println("Room that requires lowest BTUs per Hour: " + low_ROOM); 60 61 } 62 63 public static void showTitle() 64 { 65 System.out.println(); 66 System.out.println("Air Conditioning Window Unit Cooling Capacity"); 67 System.out.println(); 68 } 69 70 public static double calculateArea(double length, double width) 71 { 72 double area; 73 area = length * width; 74 return area; 75 } 76 77 public static String translateShadeChoiceToString(int shade, String shadeAmount) 78 { 79 if(shade == 1) 80 { 81 shadeAmount = "Little"; 82 } 83 else if(shade == 2) 84 { 85 shadeAmount = "Moderate"; 86 } 87 else 88 { 89 shadeAmount = "Adundant"; 90 } 91 return shadeAmount; 92 } 93 public static double calculateBTUsPerHour(double area, int shade, double BTU) 94 { 95 if(area < 250) 96 { 97 if(shade == 1) 98 { 99 BTU = 7000; 100 } 101 else if(shade == 2) 102 { 103 BTU = 5500; 104 } 105 else 106 { 107 BTU = 5000; 108 } 109 } 110 else if(area >= 250 && area <= 500) 111 { 112 if(shade == 1) 113 { 114 BTU = 12000; 115 } 116 else if(shade == 2) 117 { 118 BTU = 10000; 119 } 120 else 121 { 122 BTU = 8000; 123 } 124 } 125 else if(area > 500 && area < 1000) 126 { 127 if(shade == 1) 128 { 129 BTU = 21000; 130 } 131 else if(shade == 2) 132 { 133 BTU = 17500; 134 } 135 else 136 { 137 BTU = 12000; 138 } 139 } 140 else 141 { 142 if(shade == 1) 143 { 144 BTU = 28000; 145 } 146 else if(shade == 2) 147 { 148 BTU = 24000; 149 } 150 else 151 { 152 BTU = 20000; 153 } 154 } 155 return BTU; 156 } 157 158 public static void displayRoomInformation(String room, double area, String shadeAmount, double BTU) 159 { 160 System.out.println("Room Name: " + room); 161 System.out.println("Room Area (in square feet): " + area); 162 System.out.println("Amount of Shade: " + shadeAmount); 163 System.out.printf("BTUs Per Hour needed: %,.0f ", BTU); 164 } 165 }

Information in the text file

Room name Length Width Shade

This is the text file

Guest Bedroom 10 15.5 3

Master Bedroom 16 16.25 2

Living Room 30 25 1

Grand Dining Room 40 55 2

Master Bathroom 10 8.5 3

Guest Bathroom 8 9 1

Sample Input and Output

Air Conditioning Window Unit Cooling Capacity

Room Name: Guest Bedroom

Room Area (in square feet): 155.0

Amount of Shade: Abundant

BTUs Per Hour needed: 5,000

Room Name: Master Bedroom

Room Area (in square feet): 260.0

Amount of Shade: Moderate

BTUs Per Hour needed: 10,000

Room Name: Living Room

Room Area (in square feet): 750.0

Amount of Shade: Little

BTUs Per Hour needed: 21,000

Room Name: Grand Dining Room

Room Area (in square feet): 2200.0

Amount of Shade: Moderate

BTUs Per Hour needed: 24,000

Room Name: Master Bathroom

Room Area (in square feet): 85.0

Amount of Shade: Abundant

BTUs Per Hour needed: 5,000

Room Name: Guest Bathroom

Room Area (in square feet): 72.0

Amount of Shade: Little

BTUs Per Hour needed: 7,000

Room that requires highest BTUs per Hour: Grand Dining Room

Room that requires lowest BTUs per Hour: Guest Bedroom

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!