Question
Basically Create the above images, thats what the code should output student.java public class Student extends Person{ String status; String Major; Student(String informedFirstName, String informedLastName,
Basically Create the above images, thats what the code should output
student.java
public class Student extends Person{ String status; String Major;
Student(String informedFirstName, String informedLastName, int informedAge) { super(informedFirstName, informedLastName, informedAge); if (informedAge
String whatIsUp() { int n = 0; String b = "..."; n = (int) (Math.random() * 3); if (n == 0) { b = "Attending class"; } if (n == 1) { b = "Doing homework"; } if (n == 2) { b = "Surfing the web";
} return b; } String getStatus() { return status; }
String getInfo() { return ("Name = " + getName() + ", age =" + getAge() + ", Status = "+getStatus()+ ", Major= "+getMajor()); }
} class Person{ String informedFirstNam; String informedLastName; int informedAge; public Person(String informedFirstName, String informedLastName, int informedAge) { this.informedFirstNam=informedFirstName; this.informedLastName=informedLastName; this.informedAge=informedAge; } String getName() { return(this.informedFirstNam+" "+this.informedLastName); } int getAge() { return(this.informedAge); } }
app.java
public class app { public static void main(String args[]) { myJFrame mjf = new myJFrame(); } } myJFrame.java
import java.awt.*; import javax.swing.*; public class myJFrame extends JFrame { public myJFrame () { super ("My First Frame"); myJPanel mjp = new myJPanel(); getContentPane().add(mjp,"Center"); setDefaultCloseOperation(EXIT_ON_CLOSE); setSize (800, 480); setVisible(true); } } myJPanel.java
import java.awt.*; import javax.swing.*; public class myJPanel extends JPanel { public myJPanel () { super (); GridLayout grid = new GridLayout(1,1); setLayout(grid); //try commenting the two lines above to run the lab without a layout setBackground(Color.green); PanelLeft left = new PanelLeft(); PanelRight right = new PanelRight(); add(left); add(right); } } Panelleft.java
import java.awt.*; import javax.swing.*; public class PanelLeft extends JPanel { public PanelLeft () { super (); GridLayout grid = new GridLayout(1,1); setLayout(grid); //try commenting the two lines above to run the lab without a layout setBackground(Color.pink); JButton jb1 = new JButton("I belong to panel left"); add(jb1); } } Panelright.java
import java.awt.*; import javax.swing.*; public class PanelRight extends JPanel { public PanelRight () { super (); GridLayout grid = new GridLayout(3,1); setLayout(grid); //try commenting the two lines above to run the lab without a layout setBackground(Color.red); JButton jb1 = new JButton("I belong to panel right"); JButton jb2 = new JButton("Hi"); jb2.setBackground(Color.red); JButton jb3 = new JButton("I am a JButton)"); add(jb1); add(jb2); add(jb3);
} }
If you can complete the assignment with out the provided code that will do fine. Thanks
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
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