Question: this is the question i will send you my code on what i have and the error im getting import java.util.*; /** * Person class

this is the question i will send you my code on what i have and the error im getting
import java.util.*; /** * Person class * */ class Person{ // private variables private String name; private String address; private String phoneNumber; // constructor to initialize values public Person(String name, String address, String phoneNumber) { super(); this.name = name; this.address = address; this.phoneNumber = phoneNumber; } // mutators public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getPhoneNumber() { return phoneNumber; } public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } } /** * Customer class which inherits Person class * */ class Customer extends Person{ // private variables private String customerNumber; private boolean canMailReceive; // constructor to initialize values public Customer(String name, String address, String phoneNumber, String customerNumber, boolean canMailReceive) { super(name, address, phoneNumber); this.customerNumber = customerNumber; this.canMailReceive = canMailReceive; } // mutators public String getCustomerNumber() { return customerNumber; } public void setCustomerNumber(String customerNummber) { this.customerNumber = customerNummber; } public boolean isCanMailReceive() { return canMailReceive; } public void setCanMailReceive(boolean canMailReceive) { this.canMailReceive = canMailReceive; } // display function to print result public void display() { System.out.println("Customer:"); System.out.println("Name: "+getName()); System.out.println("Address: "+getAddress()); System.out.println("PhoneNumber: "+getPhoneNumber()); System.out.println("CustomerNumber: "+getCustomerNumber()); System.out.println("Recieve: "+isCanMailReceive()); } } /** * Main class * */ public class Driver{ public static void main(String args[]) { String name, address, phoneNumber, customerNumber, canReceive; boolean canMailReceive = false; Scanner sc = new Scanner(System.in); print("Enternameofcustomer: "); name = sc.next(); print("Enteraddressofcustomer: "); address = sc.next(); print("Enterphonenumberofcustomer: "); phoneNumber = sc.next(); print("Entercustomernumber: "); customerNumber = sc.next(); print("Enteryeso--doesthecustomerwanttorecievemail?:"); canReceive = sc.next(); if(canReceive.toLowerCase().trim().equals("no")) canMailReceive = false; else if((canReceive.toLowerCase().trim().equals("yes"))) canMailReceive = true; Customer c = new Customer(name, address, phoneNumber, customerNumber, canMailReceive); c.display(); } static void print(String s) { System.out.print(s); } }

Design a class named Person with fields for holding a person's name, address, and telephone number (all as Strings). Write a constructor that initializes all of these values, and mutator and accessor methods for every field. Next, design a class named Customer, which inherits from the Person class. The Customer class should have a String field for the customer number and a boolean field indicating whether the customer wishes to be on a mailing list. Write a constructor that initializes these values and the appropriate mutator and accessor methods for the class's fields. Demonstrate the Customer class in a program that prompts the user to enter values for the customer's name, address, phone number, and customer number, and then asks the user whether or not the customer wants to recieve mail. Use this information to create a customer object and then print its information. Put all of your classes in the same file. To do this, do not declare them public. Instead, simply write: class Person {} class Customer {} SAMPLE RUN \# 1: java Driver Highlight: Show Highlighted Only Enter.name of.customer: Julia.Stevens Enter-address - Of-customer: 77.Massachusetts.Ave -Cambridge, MA02139 d Enter.phone number of . customer: 61777777774 Enter.customer.number:928734502 Customer:-4 Name: - Julia. Stevens 4 Address: 77 Massachusetts Ave Cambridge, .MA.02139 Phone - Number: 61777777774 Customer-Number: 99287345024 Recieve:Mail?: :falsed Problems Detected: The contents of your standard output is incorrect
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
