public class Course { //attributes private int courseReferenceNumber; private int creditHours; private String courseName; private String instructor; // PLEASE START YOUR CODE HERE // *********************************************************
public class Course
{
//attributes
private int courseReferenceNumber;
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: " + courseReferenceNumber
+ " 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
// *********************************************************
// *********************************************************
// PLEASE END YOUR CODE HERE
//output using toString() method
System.out.println(newCourse);
System.out.print("END OF OUTPUT");
}
}
PoD. javea Input (main method of PoD.java) 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 (in PoD.java) .Read in two strings (course name and instructor name) Read in two integers (course reference number and credit hours) . Instantiate the class Course o use the information from input Output the results using the| toString() method of the Course class Output (PoD.java) The output is achieved by using the toString() method in the Course.java object classStep by Step Solution
There are 3 Steps involved in it
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started