# Cosc1415/cosc1436 | Computer Science homework help

COSC1415/COSC1436

Lab – Chapter 5A

Objective: To learn how to use looping structures, especially while loops, in a program

At the end of this lab you should know how to:

1. incorporate while loops in a program.

2. use selection, repetition, files and value-returning functions in a program.

Remember to put a line in each program that identifies you as the programmer.

Lab 5A1:  Write a program that reads the radius of a circle from a file (circles.txt). The program should use value-returning functions to calculate the area and circumference. Declare  π (pi) as a constant that equals 3.1416. The program should use a priming read and a while loop that terminates when there is no more data in the file. The output should be sent to a file and include a title and be displayed (with one decimal place) similar to what you see below. Don’t forget to put the <your name> statement in your program.

5.6  98.5  35.2

123.5  47877.7   775.7

Save a copy of the program and the output file.

Lab 5A2:  Write a program that reads test scores (four scores for each student) from a file (tests.txt). The program should use value-returning functions to determine the test average. (The test average is the average of the three highest test scores.). The program should use priming read and a while loop that terminates when there is no more data in the file. The program should output the four test scores rounded to one decimal place and the average rounded to two decimal places to a file. The labeled output should look similar to what you see below: Don’t forget to put the <your name> statement in your program.

Test 1 Test 2 Test 3 Test 4 Average

75.0  85.0   95.0  65.0   85.00

87.5  91.5  66.5  78.5  85.83

Save a copy of the program and the output file.

When you have completed the entire lab, you should e-mail the assignment to me. The subject line should be – C++ CHAP5A LAB

The following five files should be attached to the e-mail

Program for Lab5A1 and its output file

Program for Lab5A2 and its output file

## Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
\$26
The price is based on these factors:
Number of pages
Urgency
Basic features
• Free title page and bibliography
• Unlimited revisions
• Plagiarism-free guarantee
• Money-back guarantee
On-demand options
• Writer’s samples
• Part-by-part delivery
• Overnight delivery
• Copies of used sources
Paper format
• 275 words per page
• 12 pt Arial/Times New Roman
• Double line spacing
• Any citation style (APA, MLA, Chicago/Turabian, Harvard)

# Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

### Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

### Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

### Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.