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

Please help me with this JAVA Program. This project will be a Paint Calculator t

ID: 3840822 • Letter: P

Question

Please help me with this JAVA Program.

This project will be a Paint Calculator that gives the customer the area in square feet
to be painted. You will store the customer name, and details about each room in the customer’s
house. From that information, you will calculate the wall area of each room and a total for the
whole house. The data will need to be stored in a file so that you can retrieve information for
each customer’s paint requirements.

This project has these requirements:


1. Assume you are creating this program for a paying customer, and therefore it should
look, act, and be professional.


2. Assumptions: No more than 10 customers with a maximum of 4 rooms each. Make sure
your code is flexible and can handle 1-10 customers and each customer can have 1-4
rooms. The data will be written to and read from a file named: “CustomerData.txt”

3. It is assumed that all measurements are in feet and that each room is a rectangle with a
given height. Do not worry about areas in the room that would not be painted such as
ceiling, floor, doors, windows, etc.

4. All output must be formatted in a logical straightforward format. All input should have
proper prompts for the user and checking for valid input.

5. On start-up, the program should read in any existing data from the file
“CustomerData.txt”. You can only read from the file once at start-up and can only write
to the file when the user selects user item 2. “Save All Data”

6. You must use parallel arrays to store the data. (Extra Credit use an array of objects to store the data)

7. Create a CustomerData.txt file with 10 Customers including Customers Name, Room Name, Length of the Room, Width of the room and Height of the room.

8. You must create a looping menu system resembling the following:
1. Create Customer – allow user input of all items in requirement 7 above. Input must allow measurements in feet up to 1 decimal place i.e. Length = 6.5.
2. Save All Data
3. Print Customer Details – allow input of 1 customer name and print out the customer name on 1 line then the details of each room including area on separate
lines. The final line should be the total area for the customer.
4. Print All Unique Customer Names
5. Delete Customer – input customer name and delete that customer’s data from the
file and current data in memory.
6. Extra Credit – Sort Data – sort the data by customer name and also sort the data
before it is stored in the file.

9. The program must be modular using at least 2 classes including 1 class that reads in and
takes care of the customer’s details and another class that deals with input/output from
the file.

Explanation / Answer

customerdata.java

public class customerdata {

String customername;

int roomcount;

public customerdata(String customername.int roomcount) {

this.customername=customername;

this.roomcount=roomcount;

}

public String getcustomername(){

return customername;

}

public int getroomcount(){

return roomcount;

}

public String tostring(){

return "name is:"+this.customername+"and total rooms are:"+this.roomcount;

}

}

customer_overall_area.java

public class customer_overall_area{

String customername;

int totalrooms;

float area_room1;

float area_room2;

float area_room3;

float area_room4;

float total area;

customer_overall_area(String customername, int totalrooms, float area_room1, float area_room2, float area_room3, float area_room4){

this.customername=customername;

}

this.totalrooms=totalrooms;

this.area_room1=area_room1;

this.area_room2=area_room2;

this.area_room3=area_room3;

this.area_room4=area_room4;

}

public float gettotalarea(){

totalarea=area_room1+area_room2+area_rppm3+area_room4;

return totalarea;

}

}

customer_finaldata.java:

public class customer_finaldata{

String customername;

int totalrooms;

float area_room1;

float area_room2;

float area_room3;

float area_room4;

float total area;

customer_overall_area(String customername, int totalrooms, float area_room1, float area_room2, float area_room3, float area_room4, float totalarea){

this.customername=customername;

this.totalrooms=totalrooms;

this.area_room1=area_room1;

this.area_room2=area_room2;

this.area_room3=area_room3;

this.area_room4=area_room4;

this.totalarea=totalarea;

}

}

customer_room_area.java

import java.util.*;

import java.io.*;

public class customer_room_area{

public static void main(String[] args) {

List<customerdata>custdata=new ArrayList<customerdata>();

List<customerdata>custdata2=new ArrayList<customerdata>();

List<customer_overall_area>custdataoverall=new ArrayList<customer_overall_area>();

List<customer_finaldata>custfinaldata=new ArrayList<customer_finaldata>();

String customername;

int roomcount;

Scanner sc=new Scanner(System.in);

try{

String line="";

int linecount=0;

BufferedReader br= new BufferedReader(new FileReader(new File ("Customer.txt")));

while ((line =br.readLine())!=null) {

linecount ++;

if(linecount==10)

break;

else{

String split[]=line.split(" ");

customername=split[0];

roomcount=Integer.parseInt(split[1]);

customerdata cd= new customerdata(customername,roomcount);

custdata.add(cd);

}

for (int i=0;i<custdata.size();i++)

System.out.println(custdata.get(i));

if(linecount>10){

System.out.Println("Customers data is more than the limit. So, we can consider only top 10 customers' data.");

}

else{

System.out.println("total customers are:"+linecount);

}

for (int i=0;i<custdata.size();i++)

customerdata c= (customerdata)custdata.get(i);

if(c.roomcount<=4){

custdata2.add(c);

}

else{

System.out.Println("Customer number:"+i+"asked for rooms more than limit");

}

}

for (int i=0;i<custdata2.size();i++)

System.out.println(custdata2.get(i));

int customerrequriedrooms=0;

for (int i=0;i<custdata2.size();i++){

customerdata c= (customerdata)custdata2.get(i);

customerrequiredrooms=c.roomcount;

float area1=0,area2=0, area3=0, area4=0;

for (int j=1;j<=customerrequiredrooms;j++){

System.out.Println("Enter Height for room:"+j);

float height = sc.nextFloat();

Sustem.out.Println("Enter width for room:"+j);

float width=sc.nextFloat();

if (j==1)

area1=height*width;

elseif(j==2)

area2=height*width;

elseif(j==3)

area3=height*width;

elseif(j==4)

area4=height*width;

}

customer_overall_area coa= new customer_overall_area(c.customername, c.roomcount,area1,area2,area3,area4);

float totalarea=coa.gettotalarea();

custdataoverall.add(coa);

customer_finaldata cfinal =new customer_finaldata(coa.customername, coa.totalrooms,coa.area_room1, coa.area_room2, coa.area_roo3,cpa.area_room4);

custfinaldata.add(cfinal);

}

for (int i=0; i<=custdataoverall.size();i++)

System.out.println(custdataoverall.get(i));

for (int s=0; s<custfinaldata.size(); s++){

Object o= custfinaldata.get(s);

customer_finaldata sfinal= (customer_finaldata)o;

System.out.println("name is:"+sfinal.customername+"total rooms:"+sfinal.totalrooms+"room 1 area"+sfinal.area_room1+"room 2 area"+sfinal.area_room2+"room 3 area"+sfinal.area_room3+"room 4 area"+sfinal.area_room4+"total area:"+sfinal.totalarea);

}

br.close();

}catch(Exception e){

System.out.println(e);

}

}

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