2023 Homework 2 Instructions Selection statements In this homework you will design a program to | Assignment Collections
Computer Science 2023 Calculate the total price to purchase all the components required to build a state-of-the-art gaming computer from components available
2023 Homework 2 Instructions Selection statements In this homework you will design a program to | Assignment Collections
Instructions |
|
Selection statements In this homework, you will design a program to perform the following task: Calculate the total price to purchase all the components required to build a state-of-the-art gaming computer from components available on the internet. Before attempting this exercise, be sure you have completed all of chapter 3 and course module readings, participated in the weekly conferences, and thoroughly understand the examples throughout the chapter. As before, there are 3 main components of your submission including the problem analysis, program design and documentation, and sample test data.
CPU I would recommend you keep the option choices limited to 3 different components, or your program will really grow fast. For example, you could provide options for the Operating System (Windows 7, Red Hat Linux), the RAM (4 MB, 8 MB, 12 MB) and the Hard Drive Size (500 GB, 1 TB, 1.5 TB) and leave everything else as a baseline. I leave it up to you to determine which components you want to add options for and for researching the approximate prices. Be sure your prices are fairly realistic. Your analysis should be clearly written and demonstrate your thought process and steps used to analyze the problem. Be sure to include what is the required output? What is the necessary input and how you will obtain the required output from the given input? Also, include your variable names and definitions. Be sure to describe the necessary formulas and sample calculations that might be needed.
Include header and step comments in your pseudocode, using a similar approach as the example provided in section 2.3 (textbook page 86). See example 2.8 on pages 87-88).
|
|
|
Rubric Name: Assignment Rubric
|
EXAMPLE FROM BOOK
3.6 Focus on Problem Solving:
A New Car Price Calculator
In each “Focus on Problem Solving” section throughout this textbook, we will develop a longer program that makes use of much of the material in the current chapter. The program developed here contains selection structures and menus to help compute the cost of a new car purchased with various options.
Problem Statement
Universal Motors makes cars. They compute the purchase price of their autos by taking the base price of the vehicle, adding in various costs of different options, and then adding shipping and dealer charges. The shipping and dealer charges are fixed for each vehicle at $500 and $175, respectively, but regardless of the particular model, and the buyer can select the following options: type of engine, type of interior trim, and type of radio. The various choices for each option and the associated prices are listed in Table 3.4.
Table 3.4 Options available for Universal Motors’ vehicles
Engine Purchase Code Price
6 cylinder S $150
8 cylinder E $475
Diesel D $750
Interior Trim Purchase Code Price
Vinyl V $50
Cloth C $225
Leather L $800
Radio Purchase Code Price
AM/FM/CD/DVD C $100
With GPS P $400
Universal Motors would like to have a program that inputs the base price of a vehicle and the desired options from the user, and then displays the selling price of that vehicle.
Problem Analysis
This problem has very clearly defined input and output. The input consists of the base price (BasePrice), the engine choice (EngineChoice), the interior trim choice (TrimChoice), and the radio choice (RadioChoice). After the user has entered a choice for an option, the program must determine the corresponding cost of that option: EngineCost, TrimCost, and RadioCost.
The only item output is the selling price (SellingPrice) of the vehicle. To determine sellingprice, the program must also know the fixed value of the shipping and dealer charges (ShippingCharge and DealerCharge). Then the following computation is simple: SellingPrice = BasePrice + EngineCost + TrimCost + RadioCost + ShippingCharge + DealerCharge
Program Design
Roughly speaking, the following are the things our program must do:
1. Input the base price
2. Process the various option choices to compute additional costs
3. Total all the costs
4. Display the final selling price
We will input the base price in the main module and the transfer control to several submodules, one for each available option. Within each submodule, a menu will be displayed allowing the user to enter a choice for that option (See Table 3.4). Then the submodule will use this selection to determine the corresponding option cost. After all the option selections are made, another module will compute the total cost and display the results. Thus the Main module will contain the following submodules.
· Compute_Engine_Cost
· Compute_Interior_Trim_Cost
· Compute_Radio_Cost
· Display_Selling_Price
The hierarchy chart shown in Figure 3.8 shows the program modules and their relationship to one another. We now describe each of the modules in more detail.
Main Module
This module displays a welcome message, inputs the base price, and calls the other modules. In the Main module we also declare all the variables that will be used by more than one module. The pseudocode for the Main module follows:
We give our students 100% satisfaction with their assignments, which is one of the most important reasons students prefer us to other helpers. Our professional group and planners have more than ten years of rich experience. The only reason is that we have successfully helped more than 100000 students with their assignments on our inception days. Our expert group has more than 2200 professionals in different topics, and that is not all; we get more than 300 jobs every day more than 90% of the assignment get the conversion for payment.