Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help me in creating a practice java application. I need a solution to com

ID: 665273 • Letter: P

Question

Please help me in creating a practice java application. I need a solution to compare to my code.

Create a class named SeminoleCrs that includes data fields that hold the
department (for example, ENG), the course number (for example, 101), the credits
(for example, 3), and the fee for the course (for example, $360). All of the fields
are required as arguments to the constructor, except for the fee, which is calculated
at $120 per credit hour. Include a display() method that displays the course
data. Create a subclass named LabCrs that adds $50 to the course fee. Override
the parent class display() method to indicate that the course is a lab course and
to display all the data. Write an application named UseCrs that prompts the
user for course information. If the user enters a class in any of the following
departments, create a LabCrs: COP, CGS, MAT, or CHM. If the user enters any
other department, create a SeminoleCrs that does not include the lab fee.
Then display the course data. Save the files as SeminoleCrs.java, LabCrs.java,
and UseCrs.java.

Please dont make it any more complicated than you need to be.

Explanation / Answer


UseCrs:

import javax.swing.JOptionPane;

public class UseCrs
{   
public UseCrs()
{
SeminoleCrs college;
// Collect all the necessary data first to determine whether it is a lab course or not.
String dept = JOptionPane.showInputDialog(null, "Enter Department");

String courseNumString = JOptionPane.showInputDialog(null, "Enter Course Number");
int courseNum = Integer.parseInt(courseNumString);

String credString = JOptionPane.showInputDialog(null, "Enter Credits");
int cred = Integer.parseInt(credString);

// Now that we have the info we can ask the question.
if (dept.equals("BIO") | dept.equals("CHM") | dept.equals("CIS") | dept.equals("PHY"))
{college = new LabCrs(dept, courseNum, cred);}

else {college = new LabCrs(dept, courseNum, cred);}
college.display();
}

public static void main(String[] args)
{new UseCrs();}
}
SeminoleCrs:

import javax.swing.JOptionPane;
public class SeminoleCrs {

protected String dept;
protected int courseNum;
protected int cred;
protected int fee;
protected int Charge = 120;
protected int labfee;

public SeminoleCrs(String dept, int courseNum, int cred)
{
this.dept = dept;
this.courseNum = courseNum;
this.cred = cred;
fee = cred * Charge;
}

public void display(){

JOptionPane.showMessageDialog(null, dept + courseNum +
" Non-lab Course" + " " + cred +" Credits" + " Total fee is $" + fee);
}
}

LabCrs:

import javax.swing.JOptionPane;
public class LabCrs extends SeminoleCrs
{
public LabCrs(String dept, int courseNum, int cred)
{super(dept, courseNum, cred);}

public void display()
{
fee += 50;
JOptionPane.showMessageDialog(null, dept + courseNum +
" Lab Course" + " " + cred +" Credits" + " Total fee is $" + fee);
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote