Computers and Technology
07.05.2023 09:49
169
386
4
Solved by an expert

Justin Kace is promoting the metric system and wants people to be able to convert

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
Show Answers
yasminothman02
yasminothman02
4,7(32 marks)

Cut an orange into a strip.

Next, cut a slit into the side of the orange, all the way down to the core. The slit should go from one cut end to the other. Finally, use your fingers to pry open the orange, like a book, into a long strip. Use your fingers to pull the orange segments off of the peel, and eat them.

Explanation:

Popular Questions about the subject: Computers and Technology

Write thebin2Dec(String binaryString)method to convert a binary stringinto...
Computers and Technology
21.11.2022 00:18
List and the deference between MS access objects...
Computers and Technology
16.07.2022 08:57
When an attacker has access to a password file, they can run a password-cracking...
Computers and Technology
23.05.2020 12:14

New questions by subject

You to help the needy shall i drop you at the station Karim is good...
English
03.12.2021 04:56
Name four types of fire type extinguisher, and identify the type...
Health
30.06.2021 14:08
Plates answer it s urgent โ€‹...
Biology
31.07.2022 00:27
In the circle below, which of the following equations for major arc...
Mathematics
19.09.2020 04:01
The road not taken from Robert Frost - find rhetorical figures (personification,...
English
08.06.2020 17:23
Using color harmonies, you can... A.evoke emotion B.create a mood...
Arts
04.02.2023 16:50
#
#
#
#
# #

We expand our knowledge with many expert answers