Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA Is it time to register for classes again? Today you are going to create a constructor for the Course class which will define the

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

JAVA

Is it time to register for classes again? Today you are going to create a constructor for the Course class which will define the details of a course to be offered. You will then instantiate a course with information read in as input. For this task, you will make use of both 'Course.java' and 'POD.java'. POD.java' makes use of the Course class. You are going to write the constructor in the Course class in Course.java'. (Note: In the left window, you can choose either the 'POD.java' tab or the Course.java tab and toggle between the two.) You've been given an the fields of the Course class: courseReferenceNumber, creditHours, courseName and Instructor. You will build a constructor which takes in the course reference number, credit hours, course name and instructor name and assigns them to those fields. We have also created a 'toString() method to output the course details. The main method in 'PoDjava' has mostly been written for you. It reads in course details. You must use these details to instantiate the course class with a new object to be named newCourse. The main method then prints out the result using the 'toString() method of the Course class. Details for PoD.java Input The following input values are expected: - a string (courseName): the new course name - a string (Instructor): the course instructor's name - an integer (crn): the course reference number - an integer (creditHours): the credit hours for the course Processing - Read in two strings (course name and instructor name) - Read in two integers (course reference number and credit hours) - Instantiate the class Course - use the information from input - Output the results using the 'toString('method of the Course class Output The output is achieved by using the toString() method in the Course.java object class. Output The output is achieved by using the toString() method in the Course.java object class. Details for Course.java Input Parameters The following input parameters are expected: - an integer: the course reference number - an integer: the number of credit hours associated with the class - a string: the name of the course - a string: the instructor's name Processing The constructor should takes in the above input parameters and assign them to the appropriate fields associated with the class. Sample input/output: Sample Input Sample Output Rubik's cube for beginners Dr. Angela A. Siegel 17892 Course: Rubik's cube for beginners Instructor: Dr. Angela A. Siegel CRN: 17892 Credit hours: 3 END OF OUTPUT public class Course //attributes private int courseReference Number: private int creditHours; private String courseName; private String instructor; // PLEASE START YOUR CODE HERE ******** // PLEASE END YOUR CODE HERE public String toString() return "Course: "+courseName + " Instructor: " + instructor + " CRN: " + courseReference Number + " Credit hours: " + creditHours; import java.util.Scanner; public class POD { public static void main( String [] args) { Scanner in = new Scanner( System.in); String courseName = in.nextLine(); String instructor = in.nextLine(); int crn = in.nextInt(); int creditHours = in.nextInt(); // PLEASE START YOUR CODE HERE ***** **** ** **** ***************** *** *** ****** *** ***** ***** / ***** ************** ***** ************************** * I PLEASE END YOUR CODE HERE //output using toString() method System.out.println(newCourse); System.out.print("END OF OUTPUT")

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Visualization A Practical Introduction

Authors: Kieran Healy

1st Edition

0691181624, 978-0691181622

Students also viewed these Databases questions

Question

What is the value of the Clapeyron equation in thermodynamics?

Answered: 1 week ago

Question

describe the main employment rights as stated in the law

Answered: 1 week ago