Java Programming Assignment 1

 

This assignment represents 20% of the assessment for the course.

 

In each case the program should produce an appropriate prompting message before reading data from the keyboard, and should output the answer(s) on a new line with an appropriate message.

 

  1. Write a program that reads in three integer numbers from the keyboard and outputs the average. [Hint: use FirstProgram and adapt it].

 

  1. Write a program that converts degrees Fahrenheit to degrees Celsius using the formula
    DegreesC = 5(DegreesF - 32)/9. [Hint: adapt your answer to 1.]

 

  1. Write a program that reads a Malta phone number (eight digits) and outputs the same number, one digit per line. [Hint: first read a string. See String Methods for a listing of built in methods for handling strings]

 

  1. Write a program which reads an integer number of seconds and outputs the equivalent number of days, hours, minutes and seconds. [Hint:  adapt the solution to ChangeMaker]

 

Deadline: Please submit your answers (4 java file attachments) to me by email by 8th November.

 

References:

 

·         Savitch Chapter 2 contains most of the information.

·         Otherwise, a good starting point for tutorial material is http://java.sun.com/docs/books/tutorial/java/index.html

·         Otherwise, use Google to search for “java tutorial”

 

 

 

MR

[02/11/06]