Question
Can someone help me write this code in java? Input dialog box for initial user prompt How many properites would you like to enter? 5
Can someone help me write this code in java?
Input dialog box for initial user prompt
How many properites would you like to enter? 5
Input dialog boxes with sample input for Property 1
Enter the address for property 1: 287 acorn street
Enter the value for property 1: 150000
Console output
Month End Sales Report
Address Price
287 acorn street 150000
12 maple ave 310000
8723 marie ln 6500
222 acorn st 127000
29 bahama ln 450000
Total 1102500
Submission
Name your Java source code file SalesReportAppXXX.java, where XXX is your initials.
Operation
Use a dialog box to ask the user how many properties they would like to enter.
Use dialog boxes to prompt the user to enter the address and the price for each property.
Display the address and price for each property as it is entered.
Use an accumulator variable to calculate the sum of all the property prices.
Display the accumulator variable after all properties entered.
Specifications
Use pseudocode and/or flowcharts to map out your logic before you start coding! This will not be turned in for points, but it will help you gather your thoughts and will aide you in creating a successful application.
Declare the following variables as the specified data types:
o total as an int with an initial value of 0
o numProperties as an int
o counter as an int
o propertyAddress as a String
o propertyPrice as an int
o HEADING1 as a String constant with a value of MONTH-END SALES REPORT
o HEADING as a String constant with a value of Address\t\t\tPrice
Use the showInputDialog() method from the JOptionPane class to get user input.
o numProperties should be stored as an int
o propertyAddress should be stored as String
o propertyPrice should be stored as int
o Use meaningful, descriptive prompts as indicated in the sample above
o Use counter as part of your prompts to indicate which property the user is entering
Use an accumulator variable to add up all the property values.
Use a while loop or for loop to get the user input and calculate the total property value.
o The variable counter will be used as the loop control variable in either case
o Initialize, test, and alter your loop control variable no matter which type of loop you choose to use
o The variable numProperties will be used in your test expression to know when to stop the loop
Terminate the application.
Console window output:
o Display HEADING1 at the top followed by a blank line
o Display HEADING2 followed by a blank line
o Display the output for each property one line at a time (as its entered) using the tab escape character (\t) to line up the output with the HEADING2 output
o Display another blank line and then the total property value (after the loop to get input is closed)
Assume the user will enter valid int values for the property price.
Include appropriate comments throughout the code, and include a comment header at the top that contains your name, date, filename, and purpose.
Test thoroughly.
Produce output that matches above example.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started