Submitted by: Submitted by CoyoteCrash
Views: 99
Words: 971
Pages: 4
Category: Science and Technology
Date Submitted: 11/16/2014 05:26 PM
Talbot, James
CMIS 102 Introduction to Problem
Solving and Algorithm Design
Section 7383
Homework 2
Professor: Saggot, Bob
Due: Oct 19, 2014 11:59 PM
Program Description:
This program will calculate prices of computer components and give a summation of the price of the computer components, based solely on the pricing of the three components. The prices are float numbers, due to the need for numbers after the decimal point. Once the calculations of the prices for each case are made, each case’s total price will be printed on the output screen.
Analysis:
We will use sequential programming statements
We will define the float numbers:
Test Case 1: CPU, Hard_Drive, Monitor
Test Case 2: Power, Motherboard, OS
Test Case 3: Case, RAM, GC
Price will be the sum of the three components in each case.
Test Plan:
The following input numbers will be used for testing. Also the expected output is shown below.
Test Case # | Input | Expected Output |
1 | CPU: $59.99Hard Drive: $102.99Monitor: $156.76 | Total Price: $319.74 |
2 | Power Supply: $79.99Motherboard: $70.39Operating System: $149.95 | Total Price: $300.33 |
3 | Case: $64.99RAM: $83.99Graphics Card: $219.55 | Total Price: $368.53 |
Test Case 1:
Pseudocode:
// This program will calculate the estimated cost of a gaming computer.
//Declare Variables
Declare CPU, Monitor, Hard_Drive, Base, Price as Float
// Ask user for CPU
Write “Enter the price of the CPU:”
Input price
//Ask user for Monitor
Write “Enter the price of the Monitor:”
Input Price
//Ask User for Hard_Drive
Write “Enter the price of the Hard Drive:”
Input Hard_Drive
//Ask user for Base
Write “Enter the Base Price:”
Input Base
//Calculate the Price
Set Price = Base + CPU + Hard_Drive + Monitor
//Print Price
Print “Total Price is:” + Price
C Code:
// C code
// This program will calculate the estimated cost of a gaming computer.
// Developer: Andrew Veach
// Date: Oct 18, 2014
#include...