ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 8 Weeks Ago, 4 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 27 May 2017 My Price 8.00

Create a class ProgramStudent

Create a java project.

Situation: Students in a certain degree program must take four courses, Intro, Theory, Practical I, and Practical II.  In each they receive a grade from 0.0 to 4.0. 

☑ Create a class ProgramStudent to represent these students, which has last name, first name, ID number, and a grade for each of the four courses (think about what types are appropriate for these instance variables).  (You only need one ProgramStudent class!)

☑ Add a method to the class

public void aceIntro()

in this method,

  •  print out a message saying that the student aced the Intro course, 
  • and set the instance variable for the grade for Intro to 4.0. 

☑ Write three more methods for acing the other courses, doing the same kind of thing

☑ Then write four more, similar, methods for failing each of the courses (grade for fail is 0).

☑ Add a toString which returns something like

Holmes, Sherlock (ID#44221) -- Program GPA: 4.0

There are several ways to do this. You can do the math right in the return statement the way you can in a println (think about using parentheses).  You may find it easier to create local variables (as you would in main) inside toString for doing the math before the return statement.  Just make sure the return is the LAST statement in toString  (Do not add extra instance variables to the class to do this.)

☑ Also add a second  class with a main and there test out that all your variables and methods work correctly.

☑ Add to the ProgramStudent class an instance variable partner.  This variable should be of type ProgramStudent.  (Not String!  ProgramStudent!!!).  In your main, set up two students (make two instances) and make them each other's partner.  Then, check in your main that you can do things like (you may have to change these to match your variable names...).  

student1.partner.introGrade = student1.introGrade; // student1's partner's intro grade

or

student1.partner.partner.partner.partner.acePracticalI(); // student1's partner's partner's partner's partner aces the Practical I

Print the student grades before and after doing these, and see if the changes make sense to you.

Answers

(11)
Status NEW Posted 27 May 2017 04:05 AM My Price 8.00

-----------

Attachments

file 1495858407-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)