# Revision2 - M IST270 C omputer Util in Business F all...

This preview shows pages 1–3. Sign up to view the full content.

MIST270: Computer Util. in Business Fall 2010/2011 Introduction Part II Algorithm Writing Revision Objectives The objective of this lab is a quick revision for the following concepts: Basic components of a Java program, including identifiers, data types, arithmetic operators. How to input data and how to output results. Edit, compile, run, and test your application. Predefined and user defined methods Use the conditional statements and loops Use of 1D array Exercise #1:    Write a program to do: a) Prompts the user to input three test grades. Each grade is an integer number. b) Prints the three grades one per line in reverse order of input and labeled as Test1, Test2, and Test3. c) Finds the sum of the three tests and their average. d) Prints the sum and average of the three tests. Sample input/output:  (The average is supposed to be actually 74.33, so why did we get 74?) 1/5 Enter three grades: 69 73 81 The grades that you entered are: Test3: 81 Test2: 73 Test1: 69 The sum of the grades is: 223 The average grade is: 74

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Solution for Exercise#1: public static void main(String[] args) {         Scanner input = new Scanner( System.in);         int testGrade1;         int testGrade2;         int testGrade3;         int sum;         int average;         System.out.print("Enter three grades:");
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 5

Revision2 - M IST270 C omputer Util in Business F all...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online