So I have been struggling with this prompt for some time. Basically I need to use dialog boxes in the creation of a program to be used in billing for construction companies. The prompt is as follows. First: Read the following data from separate dialog boxes. This needs to be done for the name of the construction firm, name of the customer, number of labor hours for the foreman, number of workers, number of days on the job, and finally the cost of materials. Second: the following must be calculated from the information obtained from the dialog boxes. The calculations are as follows: Foreman labor cost=foreman labor hours times 60, worker labor cost= number of days times 8 hours per day times number of workers times $30, job fee= Forman labor cost+ worker labor cost+ materials, discount= job fee times 10%, the final amount due= job fee- discount. Lastly, all the data must be printed. The output should look something like Construction firm name, customer:xxxxx, number of days =xxxxx, foreman labor cost =xxxxx, worker labor cost =xxxxx, Materials cost =xxxxx, Job Fee =xxxxx, Discount=xxxxx, Final Amount Due =xxxxx. My question is I cannot get the code to run to produce the output I need using the information from dialog boxes? Every time I try and run the program it is terminated so I am a bit confused I am fairly new to Java so any help would be appreciated The code I have so far is as follows:
package bill;
import javax.swing.JOptionPane;
public class ContractorBill
{
public static void main(String[]args) {
}
double forhours,workers,daysonjob,costofmaterials,flcost,wlcost,jobfee,discount,finalamount;
String fname,cname,forstring,wstring,dojstring,comstring,printdata="";{
fname=JOptionPane.showInputDialog(null,"Enter the name of the construction firm","Input Data",JOptionPane.QUESTION_MESSAGE);
cname=JOptionPane.showInputDialog(null,"Enter the customer's name","Input Data",JOptionPane.QUESTION_MESSAGE);
forstring=JOptionPane.showInputDialog(null,"Enter the number of labor hours required for the foreman","Input",JOptionPane.QUESTION_MESSAGE);
wstring=JOptionPane.showInputDialog(null, "Enter the number of workers required","Input",JOptionPane.QUESTION_MESSAGE);
dojstring=JOptionPane.showInputDialog(null,"Enter the number of days required to complete the job","Input",JOptionPane.QUESTION_MESSAGE);
comstring=JOptionPane.showInputDialog(null,"Enter the cost of materials required for the job"+"Input",JOptionPane.QUESTION_MESSAGE);
forhours=Double.parseDouble(forstring);
workers=Double.parseDouble(wstring);
daysonjob=Double.parseDouble(dojstring);
costofmaterials=Double.parseDouble(comstring);
flcost=60*(forhours);
wlcost=8*(daysonjob)+30*(workers);
jobfee=(flcost)+(wlcost)+(costofmaterials);
discount=(jobfee)*0.10;
finalamount=(jobfee)-(discount);
printdata=printdata+"CONSTRUCTION FIRM NAME="+fname+"\n"+
"CUSTOMER:"+cname+"\n"+
"Number of days ="+daysonjob+"\n"+
"Forman labor cost ="+flcost+"\n"+
"Worker Labor Cost ="+wlcost+"\n"+
"Materials cost ="+costofmaterials+"\n"+
"Job Fee ="+jobfee+"\n"+
"Discount ="+discount+"\n"+
"Final Amount Due ="+finalamount+"\n";
JOptionPane.showMessageDialog(null,printdata,"Output:",JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}}