CMSC 160 -- Lab 3

Lab 3

Getting Started

Log into the computer science server and use wget and tar to download your starter code.
  1. Use wget to download the file at http://cs.longwood.edu/courses/cmsc160/f17/files/lab3.tgz
  2. Uncompress the lab3.tgz file by using tar -xvzf lab3.tgz
  3. Use ls to see that there is a new directory called lab3
  4. Use cd lab3 to change directory to the lab3 directory


Linux Commands

We can create new files and directories but sometimes we need to move or delete our files.
  • rm filename permanently removes (deletes) the file
  • cp oldname newname copies the file at oldname to a new file at newname.
  • mv oldname newname moves the file from oldname to the file newname. Note this does not copy, can overwrite files and removes the original file!
Each of these commands has additional options, you can find out more about linux commands by reading the man pages found using the man program. Try out man cp to see all of the options.

The Problem

Write the code for a program that prompts for three double numbers and prints out the max, min, median, and average. In this lab we will:
  1. write test cases
  2. write a README
  3. practice using conditions
Remember, you will be graded on style, syntax, functionality, test cases, and correctness.
An Example README.txt:
Lab3: Three Numbers
Author: Julian Dymacek
Date: 2017 Sept. 5

A program to compute statistics about three decimal numbers.

To compile:
	make

To run:
	./lab3

Test case:
    input:
		 1 3 5
	output:
		median is 3.0
		max is 3.0
		min is 1.0
		average is 3.0 

		


Implementation

You should start by creating test cases. What are possible tricky conditions that you should test? Next think about what data you will need to store. What kind of information do you need to output?

Handin

When you are done you may hand in your lab by using make handin.

The lab is due at 11:59pm Sept. 12th 2017.