Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Java Program for Assignment 3 - Introduction to Computer Architecture | CS 0007, Assignments of Computer Science

Material Type: Assignment; Class: INTRO TO COMPUTER PROGRAMMING; Subject: Computer Science; University: University of Pittsburgh; Term: Fall 2005;

Typology: Assignments

Pre 2010

Uploaded on 09/02/2009

koofers-user-vjr
koofers-user-vjr 🇺🇸

4

(1)

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Program 3 Java Due: Nov 1, 2005
Write a Java program that has three parallel arrays defined in the following way:
name: age: qpa:
Ozzy 15 1.23
Madonna 14 3.52
Pele 17 3.41
Maradonna 14 2.88
Posh 16 2.65
Leonardo 18 3.87
Parallel arrays are set up so that each array, for a given index value, contains information
that is related. For example, the person in array name[index = 2] has a grade average in
array qpa[index=2], and the age of the person is age[index=2] years old. So “Pele” is 17
years old and has a qpa equal to 3.41.
Create these arrays with these initial values stored in them. Write a program that has
three public static functions defined in the following table:
Method name Return type Input arguments Actions
top_of_class String name[], qpa[] Exams entries in array qpa and
returns the name of the person
with the highest qpa.
avg double qpa Returns the average qpa of all
people.
how_old int name[], target,
age[]
Returns the age of the person
whose name is stored in
variable target [String]
Your main method will have a loop that will ask the user what option she wants to take
and display 4 choices:
1. find and display the student with the highest qpa
2. calculate and display the average qpa for all students
3. find the age of a specific person [this will require an additional input for a
name], display the name and age
4. quit
While the user selects 1 through 3, process the request by calling the appropriate method,
display the 4 options and ask the user for her input. Keep processing requests until the
user selects option 4.
Document each method in your program with internal comments. Turn in your program
according to usual submission instructions.

Partial preview of the text

Download Java Program for Assignment 3 - Introduction to Computer Architecture | CS 0007 and more Assignments Computer Science in PDF only on Docsity!

Program 3 Java Due: Nov 1, 2005 Write a Java program that has three parallel arrays defined in the following way: name: age: qpa: Ozzy 15 1. Madonna 14 3. Pele 17 3. Maradonna 14 2. Posh 16 2. Leonardo 18 3. Parallel arrays are set up so that each array, for a given index value, contains information that is related. For example, the person in array name[index = 2] has a grade average in array qpa[index=2], and the age of the person is age[index=2] years old. So “Pele” is 17 years old and has a qpa equal to 3.41. Create these arrays with these initial values stored in them. Write a program that has three public static functions defined in the following table: Method name Return type Input arguments Actions top_of_class String name[], qpa[] Exams entries in array qpa and returns the name of the person with the highest qpa. avg double qpa Returns the average qpa of all people. how_old int name[], target, age[] Returns the age of the person whose name is stored in variable target [String] Your main method will have a loop that will ask the user what option she wants to take and display 4 choices:

  1. find and display the student with the highest qpa
  2. calculate and display the average qpa for all students
  3. find the age of a specific person [this will require an additional input for a name], display the name and age
  4. quit While the user selects 1 through 3, process the request by calling the appropriate method, display the 4 options and ask the user for her input. Keep processing requests until the user selects option 4. Document each method in your program with internal comments. Turn in your program according to usual submission instructions.