subject

Justin Kace is promoting the metric system and wants people to be able to convert miles to kilometers and kilometers to miles. You are to develop a program that asks the user for a number of miles and converts miles to kilometers (multiplying miles by 1.609), and then asks for a number of kilometers and converts kilometers to miles (multiplying kilometers by 0.6214). Using pseudocode, develop an algorithm to solve this problem. Save your algorithm in a file named metricConverter. txt in Notepad.
Programmer's Workshop
In the Programmer's Workshop, you study a business problem and develop an Algorithm for a solution as a programmer would approach it. For this problem, you use pseudocode as the programming tool. In future modules, you use other tools, including flowcharts and JavaScript. These problems help you put together what you've learned in the module, paying special attention to good programming style.
Problem: Sunshine Books is a bookstore that's open every morning from 8:00 am to 12:00 pm. The manager wants information about the number of customers in the store at different times. A clerk, whose station is near the door, counts customers by making a mark on a piece of paper each time a customer enters. The paper is divided into four segments, one for each hour, and the clerk notes the time before making each mark. When the store closes at noon, the clerk wants to enter the numbers in the program, which then displays the total number of customers for the day and the average number of customers per hour.
Your job, as the programmer, is to develop an algorithm by using pseudocode. If the manager likes your pseudocode proposal, you might be invited back to write the program in an actual computer language.
Discussion: Use the IPO method to get started:
What outputs are requested? Total Customers and average customers per hour
What inputs are available? Number of customers for each hour
What processing is required? Get input, add numbers for total, and divide by number of hours for average
The next step is deciding what variables and constants you need. You need a variable for each item you want to keep track of (that is, each input and output) and sometimes a temporary variable for calculations. You should use a constant when you know ahead of time how many of something you have. Choose your variables and constants, giving them the following names and data types:
Total Customers (numeric): totCust
Average customers per hour (numeric): avgCust
Count of customers each hour (numeric): count1, count2, count3, count
Number of hours (numeric constant): NUM_HOURS
1. Open a new file in Notepad and save it as customerstats. txt
2. Start by entering your four documentation items, substituting your name for the author name and today's date for the date last modified:
// Program Name: Customer Statistics
/Purpose: Compute total and average number of customers over 4 hours
// Author: Adrian Tillman
// Date Last Modified: 01-13-2018
3. Next declare your variables and constants. Labeling the sections with a comment is helpful. Notice that some comments are placed on a separate line from the declaration for better readability. The entire program after the documentation lines is placed between the keywords Start and Stop.
Start
//Variables and constants
Declare Numeric totust //total customers
Declare Numeric avgCust//average customers per hour
Declare Numeric count1, count2, count3, count4//count of customers each hour
Declare Constant NUM_HOURS = 4 // number of hours
4. Now you're ready to get the input, do the calculations and display the output. Don't forget to display a program heading and thank the user at the beginning of the program!
// Program Heading
Display "Sunshine Books Customer Statistics Program
//Get number of customer for each hour
Display "Enter the # of customers for the first hour."
Input count1
Display "Enter the # of customers for the second hour:
Input count2
Display "Enter the # of customers for the third hour."
Input count3
Display "Enter the # of customers for the fourth hour:
Input count4
// Compute total and average, and display results
totCust = count1 + count2 + count3 + count4
avgCust = totCust/NUM_HOURS
Display "Total number of customers: " + tot Cust
Display "Average customers per hour:" + avgCust
//Thank the user for using this program
Display "That you for using this program. Good-bye!"
stop

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 13:00
"in program arrays12.java a swap method is called. does the swap method exchange parameter values x and y? "
Answers: 3
question
Computers and Technology, 22.06.2019 11:00
Which are examples of note-taking tools? check all that recording devices sticky notes digital highlighters paper flags highlighting pens digital displays digital flags
Answers: 1
question
Computers and Technology, 22.06.2019 15:00
This is not a factor that you should use to determine the content of your presentation. your audience your goals your purpose your technology
Answers: 1
question
Computers and Technology, 22.06.2019 22:00
What is the name of the option in most presentation applications with which you can modify slide elements? 1. the option enables you to modify a slide element in most presentation applications.
Answers: 3
You know the right answer?
Justin Kace is promoting the metric system and wants people to be able to convert miles to kilometer...
Questions
question
Mathematics, 23.04.2020 23:09
question
Chemistry, 23.04.2020 23:09
question
Mathematics, 23.04.2020 23:09
question
Mathematics, 23.04.2020 23:09
question
Mathematics, 23.04.2020 23:09
question
Mathematics, 23.04.2020 23:09
Questions on the website: 13722360