[Solved] COSC6000 homework02

$25

File Name: COSC6000_homework02.zip
File Size: 178.98 KB

SKU: [Solved] COSC6000 homework02 Category: Tag:
5/5 - (1 vote)

Suppose we have several students scores and we want to develop a program that calculate the average score.

Requirements:

User inputs score one by one.

The score is a positive or zero integer value.

When user inputs a negative value, the program calculates the mean score and is finalized. The mean score is rounded off to the first decimal place.

This task could be broken down into the following procedures:

  1. Initialize variables to store the number of student and the sum of score. (count=0 and sum=0)
  2. Start a loop
  3. Get a students core. (cin >> score)
  4. If the core is negative, exit from the loop. (go to 8)
  5. Add the score to the sum. (sum += score)
  6. Increment the counter. (count++)
  7. Go back to 3
  8. Compute the mean score. (mean = sum / count)
  9. Print the result.

Part 2

We develop Buying Soda code similarly with Buying Pizza code. (See Sample) What size Soda is the best buy?

Which size gives the lowest cost per a little?

Soda sizes given in little.

Quantity of soda is based on the volume. Buying Soda Problem Defini on

Input:

Volume of two sizes of soda.

Cost of the same two sizes of soda.

https://tulane.instructure.com/courses/2165899/assignments/13460471 1/2 4/23/2018 Homework 02

Output:

Cost per a unit volume for each size of soda.

Which size is the best buy,

Based on lowest price per a unit volume,

If cost per a unit volume is the same, the smaller size will be the better buy.

Buying Soda Problem Analysis

Subtask 1

Get the input data for each size of soda

Subtask 2

Compute price per a unit volume for smaller soda

Subtask 3

Compute price per a unit volume for larger soda

Subtask 4

Determine which size is the better buy

Subtask 5

Output the results

* Declare and define a function to process Subtask 2 and 3.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] COSC6000 homework02
$25