Write a program using OOP to contain the following methods. Use proper constructor and instantine different object to use the specified ,methods. The program must be interactive.
A method called “displayCourse” which displays the name of CS courses offered in Loudoun. (CS200..)
Set Coursename()
Display Course time()
Display Course name()\
HInt: Course info a=new courseInfo()
a.displayCourseTime(name, …)
Course name - CSC 200 , time 9;30 am CSC 201 time : 9:30 am
//Oops java code
// CourseInfo.java
public class CourseInfo
{
private String courseName;
private String time;
public CourseInfo()
{
courseName = "";
time = "";
}
public CourseInfo(String courseName, String time)
{
this.courseName = courseName;
this.time = time;
}
public void setcourseName(String courseName) {
this.courseName = courseName;
}
public void setTime(String time) {
this.time = time;
}
public void displaycourseName() {
System.out.print("Course name -" + courseName + ", ");
}
public void displayCourseTime() {
System.out.println("time: " + time);
}
public void displayCourse()
{
displaycourseName();
displayCourseTime();
}
public static void main(String[] args)
{
CourseInfo a = new CourseInfo();
a.setcourseName("CSC 200");
a.setTime("9:30 am");
a.displaycourseName();
a.displayCourseTime();
CourseInfo b=new CourseInfo();
b.setcourseName("CSC 201");
b.setTime("9:30 am");
b.displayCourse();
}
}
![Terminal . (137, 60%) 10:05 PM ubuntu 1 // Courses.java 4 public class CourseInfo private String courseName: private String time; eubuntu@ayushv: ~/Desktop/codes/HomeworkLibsolution ubuntucayushv: /Desktop/codes/HomeworkLibsolutions javac CourseInfo.java ubuntu-ayushv: . Desktop /codes/HomeworkLibsoluti java CourseInfo Course name -CSC 200, tine: 9:30 am Course name -CSC 20, tine: 9:30 am ubuntucayushv: /Desktop/codes/HomeworkLibsolution$ public CourseInfo) 10 courseName time 12 13 14 15 16 17 18 19 20 21 public CourseInfo(string courseName, String time) this.courseNamecourseName; this.time time; public void setcourseName(String courseName) this.courseName-courseName 23 24 public void setTime(String time) this.time time; 26 27 28 29 30 31 32 public void displaycourseName) System.out.print(Course name -courseName + ) public void displayCourseTime) System.out.println(time:time; 34 35 36 37 38 39 public void displayCourse) displaycourseName); displayCourseTime); 42 43 public static void main(Stringl] args) CourseInfo a -new CourseInfo) 45 46 47 a.setcourseName( CSC 280) Line 36, Column 20 Spaces: 4 Java](http://img.homeworklib.com/questions/7b583a80-81db-11eb-85cd-0be913bb3dfc.png?x-oss-process=image/resize,w_560)
Write a program using OOP to contain the following methods. Use proper constructor and instantine different...
Write java program
The purpose of this assignment is to practice OOP with Array and Arraylist, Class design, Interfaces and Polymorphism. Create a NetBeans project named HW3_Yourld. Develop classes for the required solutions. Important: Apply good programming practices Use meaningful variable and constant names. Provide comment describing your program purpose and major steps of your solution. Show your name, university id and section number as a comment at the start of each class. Submit to Moodle a compressed folder of...
Design a JAVA class called Course. The class should contain: ○ The data fields courseName (String), numberOfStudents (int) and courseLecturer (String). ○ A constructor that constructs a Course object with the specified courseName, numberOfStudents and courseLecturer. ○ The relevant get and set methods for the data fields. ○ A toString() method that formats that returns a string that represents a course object in the following format: (courseName, courseLecturer, numberOfStudents) ● Create a new ArrayList called courses1, add 5 courses to...
Need a Javascript program for an Employee class with a Constructor Function. It must contain properties of name, annualsalary and bonus of multiple employee of a company. It should contain a Method for calculateBonus. The bonus will be 20% of annualsalary. When the calculateBonus method is called, the bonus should be returned as the bonus's return value. Create a Function Called checkEmployee(). This Function when called will instantiate an employee Object Will Call the Employee's calculateBonus Method and when the...
In C++, Step 1: Implement the Student Class and write a simple main() driver program to instantiate several objects of this class, populate each object, and display the information for each object. The defintion of the student class should be written in an individual header (i.e. student.h) file and the implementation of the methods of the student class should be written in a corresponding source (i.e. student.cpp) file. Student class - The name of the class should be Student. -...
Using Phyton. Design a class Country with the use of constructor, mutator, accessor methods and implement that class to store the name of the countries, their population, their areas and regions they are located. Then write a program that reads 5 instances (US, China, Russia, Germany, India) of country class and display the name of the country, the population, the area and the region they are located.
Lab 7: Methods 1. Write a Java program called Numbers that calls the following methods and displays the returned value: o Write a method called cubeIt that accepts one integer parameter and returns the value raised to the third power as an integer. 2. Write a method called randomInRange that accepts two integer parameters representing a range. The method returns a random integer in the specified range inclusive. o Write a method called larger that accepts two double parameters and...
Write the following program in C++. Review structures, pointers and dynamic memory allocation from CSIT 839. Also, review pointers and dynamic memory allocation posted here under Pages. For sorting, you can refer to the textbook for Co Sci 839 or google "C++ sort functions". I've also included under files, a sample C++ source file named sort_binsearch.cpp which gives an example of both sorting and binary search. The Bubble sort is the simplest. For binary search too, you can refer to...
In C++ Write a program that contains a class called VideoGame. The class should contain the member variables: Name price rating Specifications: Dynamically allocate all member variables. Write get/set methods for all member variables. Write a constructor that takes three parameters and initializes the member variables. Write a destructor. Add code to the destructor. In addition to any other code you may put in the destructor you should also add a cout statement that will print the message “Destructor Called”....
Write a C++ console program that defines a class named Course that utilizes a dynamically allocated array. Do not use the vector class for this assignment. The Course class should define private data members for the name of the course, the number of students in the course, an array of student names (string*), and the capacity of the course (the array may not be full of students). Use pointer notation when dealing with the array. A 2-arg constructor should initialize...
Write a class named blend. The blend class should contain me the quantity of the total coffee in the blend (in pounds), the time of the roast (in hours use a double) of the blend, the name of the blend, and predicted yield in gallons of the blend. Each blend may contain up to three different coffees and will contain the pounds of each used. The blend should have a constructor and applicable methods and be able to display each...