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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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