Create a user-specified number of students

Assignment Help Computer Engineering
Reference no: EM132383898

ISM3230

TOPIC: Introduction to classes, attributes, methods

In Assignment 4 we kept track of student numerical scores and equivalent letter grades. The scores were stored in an array, and the grades were stored in a second array. The relationship between the arrays was implicitly based on the index: for example, it was assumed that studentScore[3] is related to studentGrade[3] because they both are for student number 3.

In object-oriented programming, we can make this relationship explicit by creating an object and keeping the data together in the object's properties. We can also include pieces of
related code in the object's methods.

TASK

Your task is to write code that will be able to create Student objects and store the score and grade data together in the objects as properties. The student object will also be able to print its own data to the screen. You will also write code for a GradingScheme class that will have the functionality to convert any integer score to a letter grade.

Then, you will create a user-specified number of students, generate random scores for the students, and convert them to letter grades. Finally, you will calculate the average score, rounded average score, and the average letter grade that corresponds to the rounded average score.

INSTRUCTIONS

1. Create a new class file Student in the project's source package. Write a Student class that will allow us to store student score and student grade in the same object. Also write a printStudent method that will print the student details to the screen.

a. The Student class should have these properties:

public int studentId

public int score

public char grade

b. The printStudent method will print to the screen the data about the student object. It should print:

Student ID: id; Score: score is grade

where id, score, and grade are the object's data properties. The method should have the following signature, i.e., it returns no value and it requires no parameter:

public void printStudent()

2. Create a new class file GradingScheme in the project's source package. This class will have the functionality to convert an integer score to a letter grade by using its own built-in scheme, so we can use it to convert student scores to grades for all student objects.

a. Use the following to create the class constants:

public static final int [][] GRADING_SCHEME =

{{'F',0}, {'D',60}, {'C',70}, {'B',80}, {'A',90}};

public static final int SCHEME_LETTER=0;

public static final int SCHEME_MINIMUM=1;

b. Write a method convertScore that will take an integer as a parameter and return its corresponding letter grade as a char. It should have the following signature:

public char convertScore(int score)

This method could be implemented as a if-else-if tree or more efficiently as a loop. The method starts with the numerical score in the score variable, and should classify it into a letter grade based on the GRADING_SCHEME array data. The method needs to return a char variable.

3. In the driver, write a test case to see if the Student and the GradingScheme code works:

a. Create a GradingScheme object and save its reference in a variable. HINT: This is similar to creating a Scanner object and saving it in a variable keyboard from previous labs.

b. Create one Student object, save its reference in a variable and set its student id and student score properties to some test values.

c. Use the grading scheme object's conversion method to convert the student's object score to a grade and save it in the student object's grade property. HINT: This can be done in one line or in multiple steps:

i. get the student object's score

ii. pass it to the grading scheme object's method for conversion

iii. store the result of the conversion

iv. set the student object's grade to the result

d. Print out the line "Test student:" and use the student object's printStudent method to print the student details. Make sure that the grade matches the score.

e. For example, if the student's id is 786, and the student's score is 78, the output should be:

4. Once you're sure the code works, comment out the printing code.

5. Ask the user for a number of students to create.

6. Declare and dimension an array of appropriate size that will hold student objects as its elements.

HINT: the variable type of the array elements is Student.

7. Use a loop to go through the array and do the following for each array element:

a. create a new Student object and save its reference in the array element for future use

b. set the Student object's id so that the students are numbered from 1 to (number of students)

HINT: the array elements are numbered from 0 to (number of students-1), so use the loop counter appropriately

c. generate a random score for the student and store it in score. Use Random class' method nextInt(int end) to get numbers from 0 to (end-1). Make student scores be in the range 50-100 inclusive.

d. covert the student score to a letter grade by using the GradingScheme object's conversion method.

e. Finally, use the student's printStudent method to print the student details to the screen

f. Note that for steps b-e you must use the saved reference to the student object from step a.

8. Use a loop to compute an average score of all students.

9. Use a Math's class round method to round the average score to a whole number. HINT: This method takes a double as a parameter and returns a long. Cast the long to an int to save the rounded value in an int variable.

10. Use the grading scheme object's conversion method to get an average letter grade from the rounded average score.

11. Print the average score, rounded average score, and average grade to the screen, see Sample output.

Reference no: EM132383898

Questions Cloud

Differentiate the competing conceptions of globalization : Differentiate the competing conceptions of globalization and undermine the various schools of thought and paradigms of Globalization.
Why do think all of these skills are necessary : A digital forensics professional must know basic IT skills, understand computer architecture and networking, and have analytical and investigative skills.
What are your NPV and IRR results : Calculate again using a 55% cannibalization for the Premium Product and a 15% cannibalization rate for the Basic Product. Show your NPV and IRR results
Define characteristics that child have been sexually abused : Please mention at least ten characteristics and/or indicators that a child may have been sexually abused (each characteristics and/or indicators).
Create a user-specified number of students : ISM3230- Create a user-specified number of students, generate random scores for the students, and convert them to letter grades.
ANSC 3500 Animal Breeding Assignment Problem : ANSC 3500 Animal Breeding Assignment - Problem Set, Homework Help - Auburn University, USA - Calculate the gene and genotypic frequencies
Describe some of the ways in which social : Describe some of the ways in which social, cultural, economic, legal, and political differences act as barriers to international trade
NRS428 Concepts In Community And Public Health Question : NRS428 Concepts In Community And Public Health assignment help and assessment help, Grand Canyon University - Communicable Disease Chain.
Function of the application : 1. Suppose Google becomes aware that apps in the Google Play store are harvesting user data unrelated to the function of the application.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Construct a truth table and find minimized boolean function

Construct a truth table and find the minimized Boolean function to implement the logic telling the CSU staff when to approve. Draw a circuit diagram for the Boolean function.

  Software reliability is very important to the success

Software reliability is very important to the success of our software engineering efforts. define the effect of maintenance activities on software reliability and how to ensure continued software reliability.

  Write the client and server code for this problem

Write the client and server code for this problem and test it with your mobile device and your computer.

  Computes the speed of the car in miles per hour

Write a C program which performs the operations like Assigns a value (425.5) representing the distance in miles traveled by a car.

  Discuss about information system management systems

To enhance the security of information systems, enterprises are developing and adopting information system management systems.

  How to assess risk if you moved your personal network

Discuss in 500 words or more how to assess risk if you moved your personal or work network to the cloud using these categories: asset, threat, vulnerabilities.

  Create an int called num and initialize

Create an int called num and initialize it to 5000. Create an int called reps and initialize it to 0.

  Define the range of general cybersecurity

From within the range of general cybersecurity topics discussed in this course, choose one narrow legal and/or ethical topic that adversely affects the general.

  Write the program with at least two functions to solve

Write the program with at least two functions to solve the following problem.

  What are the business costs or risks of poof data quality

What are the business costs or risks of poof data quality? Support your discussion with at least 3 references. What is data mining?

  Prepare the flow diagram of the information and any control

develop the flow diagram of the information and any control elements needed to ensure proper access for the

  Describe how the analytics of r are suited for big data

Compare the statistical features of R to its programming features. Describe how the analytics of R are suited for Big Data. The response must be typed.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd