Question: This is the problem i have my code and when i enter it it says its wrong i will upload my code and the reason

This is the problem i have my code and when i enter it it says its wrong i will upload my code and the reason why its wrong.
import java.util.Scanner;
class Person { // instance variables private String name; private String address; private String telephone; // constructor
public Person(String name, String address, String telephone) { this.name = name; this.address = address; this.telephone = telephone; } // getters and setters for every field
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 getTelephone() { return telephone; }
public void setTelephone(String telephone) { this.telephone = telephone; } } class Customer extends Person{ // instance variables private String customerNumber; private boolean receiveMail; // constructor public Customer(String name, String address, String telephone, String customerNumber, boolean receiveMail) { super(name, address, telephone); // call base class constructor this.customerNumber = customerNumber; this.receiveMail = receiveMail; } // getters and setters
public String getCustomerNumber() { return customerNumber; }
public void setCustomerNumber(String customerNumber) { this.customerNumber = customerNumber; }
public boolean isReceiveMail() { return receiveMail; }
public void setReceiveMail(boolean receiveMail) { this.receiveMail = receiveMail; }
} /// Driver class public class Driver{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); System.out.print("Enter*name*of*customer:"); String name=sc.nextLine(); // read name System.out.print("Enter*address*of*customer:"); String add=sc.nextLine(); // read address System.out.print("Enter*phone*number*of*customer:"); String phone=sc.nextLine(); // read phone System.out.print("Enter*customer*number:"); String cusNum=sc.nextLine(); // read customer number System.out.print("enter*yeso*--*does*the*customer*want*to*receive*mail?:"); String receiveMail=sc.nextLine(); // read mail want or not System.out.println(); boolean mailWant; if(receiveMail.equalsIgnoreCase("no")){ mailWant=false; }else{ mailWant=true; } // created customer class object passed all the arguments Customer cus=new Customer(name,add,phone,cusNum,mailWant); // print Customer details System.out.println("Customer:*"); System.out.println("Name:*"+cus.getName()); System.out.println("Address:*"+cus.getAddress()); System.out.println("Phone*Number:*"+cus.getTelephone()); System.out.println("Customer*Number:*"+cus.getCustomerNumber()); System.out.println("Receive*Mail?:*"+cus.isReceiveMail());
} }


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. Failed Test Run \#1 The contents of your standard output is incorrect. There is an error in your prompts. Expected Result: Your Code's Actual Result: Customer: Name:.5tacy Jones Addres5:-200-Eastern.Pkwy, New York, NY.11238 Address ;200 Eastern Pkwy, New York, NY11238 Phone.Number: 186385000 Phone*Number: *718-638-5000 Customer.Number: :3599214574 Customer*Numberi i359921457 Recieve.Mail?:-trued Receive*Mail?;*trued
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
