CMIS102 Homework Assignment 2
Student Name:
Class/Section: CMIS 102/ 3110
Professor Name:
Assignment due date: 03 February 2014
Problem definition: 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. A. Problem Analysis – Following the directions in the assignment, clearly write up your problem analysis in this section.
We are writing a program to calculate the total cost of a gaming computer system.
The total cost the computer system should be calculated using the following formula (TotalCost= CpuChoiceCost + RAMChoiceCost + HardDriveCost + ComponentsCost).
The cost will be represented by integers. The results should be placed in variable TotalCost.
The inputs, for the program are: ComponentsCost, TotalCost, A to Q, Yes or No
The output for the program is TotalCost As Float.
B. Program Design – Following the directions in the assignment, clearly write up your problem design in this section and comment your pseudocode.
Main Module
Declare MotherboardCost, CpuChoiceCost, SounCardCost, GraphicsCardCost, CaseCost, MonitorCost, PowerSupplyCost, DVDDriveCost, HardDriveCost, RAMChoiceCost, OperatingSystemCost AS Character
Declare A to R As Integer
Display a Welcome message
Write “Welcome to Computer World”
// Prompt for and input start building your system:
Write “Would you like to start building your System?”
Input Yes OR No
Display Choice
Call Compute_CPU_Cost Module
Call Compute_HardDrive_Cost Module
Call Compute_RAM_Cost Module
Call Compute_Standard_Components Module
Call Display_Total_Cost Module
END Main
Compute_CPU_Cost Module
This module displays a menu to allow the user to specify the type of CPU desired and then determines the cost of this CPU option as follows:
Display the menu and input user selection
Determine the cost of the selected option
This module will use the variable, CpuChoice, to hold the Value of the user’s choice.
Declare CpuChoice As Character
// Display the menu and input user selection:
Write “A = Intel i7 3770 CPU”
Write “B =AMD FX 8720 CPU”
Write “ C = Intel i7 3930K CPU”
Write “Selection? ”
Input CpuChoice
Determine the cost of the selected option as follows:
Select Case of CpuChoice
Case “A”:
Set CpuChoiceCost = 329
Break
Case “B”: Set CpuChoiceCost = 159 Break Case “C”: Set CpuChoiceCost = 569 Break Default: Write “Invalid Selection” End Case Compute_HardDrive_Cost Module
This module displays a menu to allow the user to specify the type of hard drive desired and then determines the cost of this hard drive option as follows:
Display the menu and input user selection
Determine the cost of the selected option
This module will use the variable, HardDriveChoice, to hold the Value of the user’s choice.
Declare HardDriveChoice As Character
// Display the menu and input user selection:
Write “D = Seagate SSHD 750 GB”
Write “E = Western Digital Green”
Write “ F = Seagate ES.2”
Write “Selection? ”
Input HardDriveChoice Determine the cost of the selected option as follows:
Select Case of HardDriveChoice
Case “D”:
Set HardDriveCost = 329
Break
Case “E”: Set HardDriveCost = 229 Break Case “F”: Set HardDriveCost = 409 Break Default: Write “Invalid Selection” End Case Compute_RAMC_Cost Module
This module displays a menu to allow the user to specify the Amount of RAM desired and then determines the cost of this RAM option as follows:
Display the menu and input user selection
Determine the cost of the selected option
This module will use the variable, RAMChoice, to hold the Value of the user’s choice.
Declare RAMChoice As Character
// Display the menu and input user selection:
Write “G = Crucial Balistix 4GB”
Write “H = Crucial Balistix 8GB”
Write “I = CORSAIR Vengeance 16GB”
Write “Selection? ”
Input RAMChoice Determine the cost of the selected option as follows:
Select Case of RAMChoice
Case “G”:
Set RAMChoiceCost = 17
Break
Case “H”: Set RAMChoiceCost = 40 Break Case “I”: Set RAMChoiceCost = 89 Break Default: Write “Invalid Selection” End Case Compute_Component_Cost Module
This module displays a menu to show the user the type of standard components already installed and then displays the cost of the components as follows:
Display the standard component and input selection
Determine the cost of the standard component
This module will use the variable, MotherboardStandard + SounCardStandard + GraphicsCardStandard + CaseStandard + MonitorStandard + PowerSupplyStandard + DvdDriveStandard + OperatingSystemSatndard, to hold the value of the standard component.
Declare MotherboardStandard, SoundCardStandard, GraphicsCardStandard, CaseStandard, MonitorStandard, PowerSupplyStandard, DvdDriveStandard, OperatingSystemSatndard As Character
// Display the menu and input Standard selection:
Write “J = MotherboardStandard”
Write “K = SoundCardStandard Creative SBR 3D”
Write “L = GraphicsCardStandard XFX Stream”
Write “M = MonitorStandard ASUS VE278Q”
Write “N = CaseStandard Rosewill R 101 ”
Write “O = PowerSupplyStandard CORSAIR HX”
Write “P = DvdDriveStandard LITE-ON BB”
Write “Q = OperatingSystemSatndard Windows 7 Pro OEM”
Write “StandardComponents ”
Input StandardComponents Determine the cost of the selected option as follows:
Select Case of StandardComponents
Case “J”:
Set MotherboardStandardCost = 59 +
Break
Case “K”: Set SoundCardStandardCost Creative SBR 3D = 99 + Break Case “L”: Set GraphicsCardStandardCost XFX Stream = 89 + Break Case “M”: Set MonitorStandardCost ASUS VE278Q = 294 + Break Case “N”: Set CaseStandardCost Rosewill R 101 = 49 + Break Case “0”: Set PowerSupplyStandardCost CORSAIR HX = 174 + Break Case “P”: Set DvdDriveStandardCost LITE-ON BB = 109 + Break Case “Q”: Set OperatingSystemSatndardCost Windows 7 Pro OEM = 139 + Write “Selections? “ Input ComponentsCost Default: Write “Invalid Selection” End Case Display_Total_Cost Module
This module displays the total cost of the gaming computer system with the selected options. To determine the total price, it uses the variables already determined in previous modules plus the use of one more new one ShippingCharge as follows:
Declare ShippingCharge, TotalCost As Float
Set ShippingCharge = 30
Set TotalCost = CpuChoiceCost + HardDriveCost + RAMChoiceCost + ComponentsCost + ShippingCharge
Write “The total price for your computer gaming system is $ ”+ TotalCost C. Program Comments and Test Data – Following the directions in the assignment; include your test data and expected results in this section.
Program to calculate the total cost of a computer gaming system.
Test Data
Room 1: length=12, width=16;
Room 2: length=8, width=12;
Room 3: length=12, width=16;
Room 4: length=8, width=12
Expected Results
House Usable Area= 5762
Table1. Include your test data table here Input: | Expected output: | | | | | | | | | | | | |