The Learning Journal is a tool for self-reflection on the learning process. In addition to completing directed tasks, you should use the Learning Journal to document your activities and record problems you may have encountered in discussions and projects. Each week’s Learning Journal entry should be a minimum of 250 words.
Use the following questions as guides to self-reflection during this week:
Briefly describe what programming you did this week.
Describe any problems you have had and how you solved your problems.
Describe any feedback you received in class and discuss how it was or was not helpful.
What skills and knowledge do you recognize that you are gaining, and how will these skills and knowledge be useful in school and as a professional after school?
Describe:
The code below uses the SWING library to further demonstrate how to create base classes such as a Person or a CollegeEmployee that can be extended to a student or a Faculty member, a Faculty member who is an extension of a Person, and a CollegeEmployee to the Faculty member class.
//File name: class_CollegeList.java
import javax.swing.*;
public class CollegeList {
public static void main(String[] args)
{
CollegeEmployee[] emp = new CollegeEmployee[4]; // 4 college employees
Faculty[] fac = new Faculty[3]; // 3 faculty
Student[] stu = new Student[7]; // 7 students
int empCount = 0, facCount = 0, stuCount = 0;
char letter; // user selection
String input;
int x;
input = JOptionPane.showInputDialog(null,
“Type C, F or S to enter data for” +
“n(C)ollege employeen(F)acultyn(S)tudent” +
“nor type Q to quit”);
letter = input.charAt(0); // Get just the 1st char
while (letter != ‘Q’) // Keep going until Q for quit
{
if(letter == ‘C’)
{
if(empCount < emp.length)
{
CollegeEmployee c = new
CollegeEmployee();
c.setData(); emp[empCount] = c; ++empCount;
}
else
JOptionPane.showMessageDialog(null,
"Sorry - too many employee records have been entered");
}
else if(letter == 'F')
{
if(facCount < fac.length)
{
Faculty f = new Faculty();
f.setData();
fac[facCount] = f;
++facCount;
}
else
JOptionPane.showMessageDialog(null,
"Sorry - too many faculty records have been entered");
}
else if(letter == 'S')
{
if(stuCount < stu.length)
{
Student s = new Student();
s.setData(); stu[stuCount] = s; ++stuCount;
}
else
JOptionPane.showMessageDialog(null,
"Sorry - too many student records have been entered");
}
input = JOptionPane.showInputDialog(null,
"Type C, F or S to enter data for" +
"n(C)ollege employeen(F)acultyn(S)tudent" +
"nor type Q to quit"); letter = input.charAt(0);
} // end of while loop
// Print out all entered and their data
System.out.println("nCollege Employees:");
if(empCount == 0)
System.out.println("No employees entered");
else
for(x = 0; x < empCount; ++x)
emp[x].display();
System.out.println("nFaculty:");
if(facCount == 0)
System.out.println("No faculty entered");
else
for(x = 0; x < facCount; ++x)
fac[x].display();
System.out.println("nStudents:");
if(stuCount == 0)
System.out.println("No students entered");
else
for(x = 0; x < stuCount; ++x)
stu[x].display();
}
}
//Base class a person
import javax.swing.*;
public class Person// a basic person
{
private String firstName;
private String lastName;
public String address;
private String zip;
private String phone;
public void setData()
{
firstName = JOptionPane.showInputDialog(null,
"Please enter first name");
lastName = JOptionPane.showInputDialog(null,
"Please enter last name");
address = JOptionPane.showInputDialog(null,
"Please enter address");
zip = JOptionPane.showInputDialog(null,
"Please enter zip code");
phone = JOptionPane.showInputDialog(null,
"Please enter phone number");
}
public void display()
{
System.out.println(firstName + " " + lastName + " " + address + " " + zip + " " + phone);
}
}
// A student extends a person
import javax.swing.*;
public class Student extends Person
{
private String major;
private double gpa;
@Override // this warns the compiler to use this special method
public void setData()
{
String temp;
super.setData();
major = JOptionPane.showInputDialog(null,
"Please enter student's major");
temp = JOptionPane.showInputDialog(null,
"Please enter grade point average");
gpa = Double.parseDouble(temp);
}
@Override public void display()
{
super.display();
System.out.println("Major: " + major + " GPA: " + gpa);
}
}
//A college employee extends a Person
import javax.swing.*;
public class CollegeEmployee extends Person {
private String ssn;
private double annualSalary;
private String dept;
@Override
public void setData()
{
String temp;
super.setData();
ssn = JOptionPane.showInputDialog(null,
"Please enter Social Security number");
temp = JOptionPane.showInputDialog(null,
"Please enter annual salary");
annualSalary = Double.parseDouble(temp);
dept = JOptionPane.showInputDialog(null,
"Please enter employee's department");
}
@Override
public void display()
{
super.display();
System.out.println("SSN: " + ssn + " Salary $" + annualSalary + " Department: " + dept);
}
}
// A faculty extends a college employee
import javax.swing.*;
public class Faculty extends CollegeEmployee
{
private boolean isTenured = false;
@Override
public void setData()
{
String temp;
super.setData();
temp = JOptionPane.showInputDialog(null,
"Is this faculty member tenured - Y or N?");
if(temp.charAt(0) == 'Y' || temp.charAt(0) == 'y')
isTenured = true;
}
@Override
public void display()
{
super.display();
if(isTenured)
System.out.println("Faculty member is tenured");
else
System.out.println("Faculty member is not tenured");
}
}
Place this order or similar order and get an amazing discount. USE Discount code “GET20” for 20% discount