Question: USE JAVA ECLIPSE The following Java program is NOT designed using class/object concept. public class demo_Programd_non_OOP_design public static void main(String[] args) { String studentl_name=John Smith:

 USE JAVA ECLIPSE The following Java program is NOT designed usingclass/object concept. public class demo_Programd_non_OOP_design public static void main(String[] args) { String

USE JAVA ECLIPSE

The following Java program is NOT designed using class/object concept. public class demo_Programd_non_OOP_design public static void main(String[] args) { String studentl_name="John Smith": String studenti degree_type="Undergraduate" int studentl_id=101, String studentl_email="js101 @kean edu" int student totalCredits: studentl_totalCredits = credit Take/ studentl_totalCredits, 4); student l_totalCredits = creditWithdraw student |_name, student |_totalCredits, 5) System.out.println("Stuent name " + studentl_name + "id" + student_id + "email:" + studentl_email +" degreeType: " + studenti degree_type+ "total credits:" + studentl_totalCredits) String student2_name "Nancy Brown". String student2_degree_type="Graduate", int student2_id=102 String student2 email="nb102@kean.edu"; int student2_totalCredits =60; student2_totalCredits = credit Take(student2_totalCredits, 12). student2totalCredits -credit Withdraw(student2_name, student2_totalCredits.2); System.out.println("Stuent name:" + student2_name + "id" + student2_id + "email" + student2_email+" degreeType: " + student2_degree_type+ ", total credits: " + student2_totalCredits) public static int credit Take{int currentCredits, intc) int totalCredits currentCredits return totalCredits: public static int creditWithdraw(String name, int currentCredits, inte) int totalCredits currentCredits: if (c > currentCredits) System.out.println(name + " does not have enough credits to withdrawl Withdraw failed."); else totalCredits currentCredits return totalCredits: a. d. Requirements: (Thinking in objects) Redesign the above Java program to meet the following requirements: (1) Design a Student class with necessary data fields, constructors and methods. b. A toString that returns a string contains student's student id, name, degree_type. email address and total credits. (2) Write a test elass(xxxx_Program) to include a main() method that does the following steps in order: Create Student object with the following information: name="John Smith", degree_type="Undergraduate", id=101 email-is101 @ kean.edu, totalCredits : b. Add 4 credits to the 1" Student object's totalCredits. c. Withdraw 5 credits from the 1" Student object's totalCredits. (Your Student class should handle the error like the above Java program does.) Print the I" Student object's information by calling 1" Student object's toString) method. Create 2nd Student object with the following information: name" Nancy Brown", degree_type "Graduate", id=102, email-nb102@ kean.edu, totalCredits =60; f. Add 12 credits to the I" Student object's totalCredits. Withdraw 2 credits from the I" Student object's totalCredits. h. Print the 2od Student objects information by calling 2nd Student object's toStringo method. (3) This Program assignment does not take any input from the keyboard. (4) DO NOT hardcode the output value in your toString() method. (5) Example output: John Smith does not have enough credits to withdraw! Withdraw failed. Student name: John Smith, id: 101, email: js 101a kean.edu, degree Type: Undergraduate, total eredits: 4 Student name: Nancy Brown, id: 102, email: nb 102 @ kean.edu, degreeType: Graduate, total credits: 70 e. 2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!