Lab Assignment--HAL Program


HAL Program

DRAFT

Write a HAL program that reads floating point values into an array from a file, finds the average of the array, then prints the average to the screen.

Your code will contain three functions:

  1. readArray
  2. averageArray
  3. main

The file that you can use to test your code is here: inputFile.txt. Don't forget to specify the directory for the file when you type the name as input.

A sample run might look like this:

a049403[36]% HALstart

HALstart: powering up HAL9000 ...
set: No match.
HALstart: HAL9000 OK
HAL9000: initializing ...
HAL9000: boot sequence started ...
HAL9000: loading HALbios ...
HAL9000: HALbios OK
HALbios: initializing ...
HALbios: checking memory ...
HALbios: memory OK
HALbios: loading HALos ...
HALbios: HALos OK
HALos: initializing ...
HALos: loading HALshell ...
HALos: HALshell OK
HALshell: initializing ...

HALshell> nova/labAssignGood.hal
Please enter a filename nova/inputFile.txt
Invalid data in file...skipping line: hello
Invalid data in file...skipping line: whoopsy
Invalid data in file...skipping line: so wrong
Invalid data in file...skipping line: indeed
The average is: 26.3167
HALshell> shutdown

HALshell: terminating ...
HALos: terminating ...
HAL9000: powering down ...
a049403[37]% 

Deliverables:

  1. Code
  2. Script of Run through HALShell

Notes