COSC 236

Lab 4

The goal of this lab is to get used with I/O in Java (discussed in Lecture #4). Take a look at the examples and the sample programs in the lecture notes and try to apply the same concepts and style when writing your own programs. You will write 4 programs, given below.


1 - 3.  Make changes to the programs you wrote last week (Lab 3) so that you take input using the Scanner class (instead of using the assignment operator) and send output using System.out.print / System.out.println / System.out.printf. Floating-point numbers should have two decimals.


4.  Grades problem: Write a Java program that computes a student's total score.

Input - test1 score, test2 score, final score, assignments
Processing - use the formula:

total_score = 15% * test1_score + 15% * test2_score + 40% * final_score + 30% * assignments

Output - the student's total score (float, 2 decimals)
Testing - test your program with the following input data:

test1 = 95; test2 = 80; final = 90; assignments = 80
The expected result is 86.25.


Notes:
A. The lab will NOT be graded, do NOT hand anything in to the instructor.
B. The lab should be completed by the start of the next scheduled lab class.
Save the .java files on your disk and e-mail them (attachments) to Vishal Patel at vpatel12@students.towson.edu

Very important: Make sure that you have COSC 236.section, your name, and Lab#4 in the Subject box of your e-mail.
C. In case you have any problems, contact the TA or the instructor for assistance.