Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using JavaFX, complete the JavaFX GUI widgets (controls / windows, etc). You should be working on finalizing the events. You should have a minimum of

Using JavaFX, complete the JavaFX GUI widgets (controls / windows, etc). You should be working on finalizing the events. You should have a minimum of two events completed as well as your complete GUI (i.e. Windows and fields). The two events should access the classes you created. This program should allow a student to input each course and how much time that is spent in each course on a weekly basis, and be able to get an overall total of hours at the end of the course.

Here is the code:

Course.java

public class Course {

private String courseTitle;

private int creditHours;

public Course(String courseTitle, int creditHours) {

super();

this.courseTitle = courseTitle;

this.creditHours = creditHours;

}

public String getCourseTitle() {

return courseTitle;

}

public void setCourseTitle(String courseTitle) {

this.courseTitle = courseTitle;

}

public int getCreditHours() {

return creditHours;

}

public void setCreditHours(int creditHours) {

this.creditHours = creditHours;

}

}

Student.java

import java.util.ArrayList;

public class Student {

//Instance Fields

private String firstName;

private String lastName;

private String address;

private String city;

private String state;

private String zip;

private String email;

private String phone;

private String degree;

private ArrayList courses;

public Student(String firstName, String lastName, String address, String city, String state, String zip,

String email, String phone, String degree, ArrayListcourses) {

super();

this.firstName = firstName;

this.lastName = lastName;

this.address = address;

this.city = city;

this.state = state;

this.zip = zip;

this.email = email;

this.phone = phone;

this.degree = degree;

this.courses = courses;

}

public String getFirstName() {

return firstName;

}

public void setFirstName(String firstName) {

this.firstName = firstName;

}

public String getLastName() {

return lastName;

}

public void setLastName(String lastName) {

this.lastName = lastName;

}

public String getAddress() {

return address;

}

public void setAddress(String address) {

this.address = address;

}

public String getCity() {

return city;

}

public void setCity(String city) {

this.city = city;

}

public String getState() {

return state;

}

public void setState(String state) {

this.state = state;

}

public String getZip() {

return zip;

}

public void setZip(String zip) {

this.zip = zip;

}

public String getEmail() {

return email;

}

public void setEmail(String email) {

this.email = email;

}

public String getPhone() {

return phone;

}

public void setPhone(String phone) {

this.phone = phone;

}

public String getDegree() {

return degree;

}

public void setDegree(String degree) {

this.degree = degree;

}

public ArrayListgetCourses() {

return courses;

}

public void setCourses(ArrayListcourses) {

this.courses = courses;

}

public int getTotalTimeSpent() {

int time = 0;

for(Course c: courses) {

time += c.getCreditHours();

}

return time;

}

}

Tester.java

import java.util.ArrayList;

import java.util.Arrays;

public class tester {

public static void main(String[] args) {

Course c1 = new Course("SDEV200", 50);

Course c2 = new Course("CPIN239", 48);

Course c3 = new Course("CPIN269", 55);

ArrayList courses = new ArrayList<>(Arrays.asList(c1, c2, c3));

Student s = new Student("John", "Doe", "123 Main Street", "Bloomington", "IN", "47404", "jdoe@yahoo.com", "812-333-4444", "AS Software Development", courses);

System.out.println("Total hours spent on all courses: " + s.getTotalTimeSpent());

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 19c DBA By Examples Installation And Administration

Authors: Ravinder Gupta

1st Edition

B09FC7TQJ6, 979-8469226970

More Books

Students also viewed these Databases questions