Question

Jump to level 1 In the Customer class, complete the public method definition for setName() with the string parameter customName. Ex: If the input is 15 Carlos, then the output is: Age: 15 Name: Carlos 1 public class Customer { 2 private int age; 3 private String name; 4 5 public void setAge(int customAge) { 6 age = customAge; 7 } 8 public void setName(int customName) 9 /* Your code goes here */ { 10 name = customName; 11 } 12 13 public int getAge() { 14 return age; 15 } Customer.java CustomerInfo.java

          Jump to level 1
In the Customer class, complete the public method definition for setName() with the string parameter customName.
Ex: If the input is 15 Carlos, then the output is:
Age: 15
Name: Carlos
1 public class Customer {
2
private int age;
3
private String name;
4
5
public void setAge(int customAge) {
6
age = customAge;
7
}
8
public void setName(int customName)
9
/* Your code goes here */ {
10
name = customName;
11
}
12
13
public int getAge() {
14
return age;
15
}
Customer.java
CustomerInfo.java
        
Show more…
Jump to level 1
In the Customer class, complete the public method definition for setName() with the string parameter customName.
Ex: If the input is 15 Carlos, then the output is:
Age: 15
Name: Carlos
1 public class Customer 
2
private int age;
3
private String name;
4
5
public void setAge(int customAge) 
6
age = customAge;
7

8
public void setName(int customName)
9
/* Your code goes here */ 
10
name = customName;
11

12
13
public int getAge() 
14
return age;
15

Customer.java
CustomerInfo.java

Added by Antonia M.

Close

Computer Science and Information Technology
Computer Science and Information Technology
Trishna Knowledge Systems 2018 Edition
AceChat toggle button
Close icon
Ace pointing down

Please give Ace some feedback

Your feedback will help us improve your experience

Thumb up icon Thumb down icon
Thanks for your feedback!
Profile picture
Jump to level 1 In the Customer class, complete the public method definition for setName() with the string parameter customName. Ex: If the input is 15 Carlos, then the output is: Age: 15 Name: Carlos public class Customer { private int age; private String name; public void setAge(int customAge) { age = customAge; } public void setName(String customName) { name = customName; } public int getAge() { return age; } Jump to level 1 In the Customer class, complete the public method definition for setName() with the string parameter customName. Ex: If the input is 15 Carlos, then the output is: Age: 15 Name: Carlos public class Customer { private int age; private String name; public void setAge(int customAge) { age = customAge; } public void setName(String customName) { name = customName; } public int getAge() { return age; }
Close icon
Play audio
Feedback
Powered by NumerAI
Jennifer Stoner David Collins
Danielle Fairburn verified

Akash M and 99 other subject AP CS educators are ready to help you.

Ask a new question

*

Labs

-

Want to see this concept in action?

NEW

Explore this concept interactively to see how it behaves as you change inputs.

View Labs

*

Key Concepts

-
Key Concept
Premium Feature
Explore the core concept behind this problem.
Play button
Key Concept
Premium Feature
Explore the core concept behind this problem.
Your browser does not support the video tag.

*

Recommended Videos

-
5-write-code-in-the-main-method-of-your-main-class-to-test-the-customer-class-a-create-a-new-customer-object-called-customer1-b-call-the-readinput-method-on-customer1-c-call-the-writeoutput-63877

5. Write code in the main method of your main class to test the Customer class. (a) Create a new Customer object called customer1 (b) Call the readInput method on customer1 (c) Call the writeOutput method on customer1 (d) The output should look something like this: Enter the customer first name: Meg Enter the customer last name: Whitman Enter the customer email address: mwhitman@hp.com First Name: Meg Last Name: Whitman Email: mwhitman@hp.com 6. Add some Boolean-valued methods to the Customer class (a) Add a private boolean-valued method called hasSameNameAs with a parameter of type Customer that returns true if the first and last name of the object the method is called on are identical to the first and last name of the parameter, and returns false otherwise. (b) Add a private boolean-valued method called hasSameEmailAs with a parameter of type Customer that returns true if the email of the object the method was called on is the same as the email of the parameter ignoring case. (c) Add a public boolean-valued method called equals with a parameter of type Customer that returns true if: - The customers have the same name (use hasSameNameAs) - The customer emails are the same (use hasSameEmailAs) Otherwise, it should return false.

Akash M.

answers-in-c-please-710-points-given-person-classextend-it-and-define-doctor-class-here-are-the-signatures-of-the-constructors-and-methods-provided-by-person-class-1-each-person-has-a-nameas-32564

7. (10 points) Given Person class, extend it and define Doctor class. Here are the signatures of the constructors and methods provided by Person class. (1) Each person has a name (as a string) and age (as an int). (2) Constructor Person() define name as "anonymous" and age as 18. (3) Constructor Person(string name) uses given parameter name to initialized data member name, and initialize age as 18. (4) Constructor Person(string name, int age) uses given parameter name to initialize data member age. If given parameter age is in the range of [0, 130], then uses given parameter age to initialize data member age, otherwise, set data member age to be 18. (5) Method string getName() returns the name of a person. (6) Method int getAge() returns the age of a person. (7) Method void setAge(int age) uses given parameter age to reset data member age if the former is in the range of [0, 130], otherwise, leave the corresponding data member as it is. (8) Method void setName(string name) uses given parameter name to reset data member name. Each doctor is a person, just with additional data member to describe the name of all insurances he/she takes. This data member insurances can be a vector of string. Your job: Declare Doctor class as a subclass of Person and define the following methods. NO NEED TO define Person class. (1) Default constructor Doctor() with insurances initialized by "medicaid" and "medicare". (2) Write a method, given a string representing a specific insurance, search whether it is in the vector of insurances or not, if yes, return true, otherwise, return false.

Akash M.

in-c-please-instructions-salestransactionde-1using-static-systemconsole-2class-salestransactiondemo-3-4-static-void-main-5-6-write-your-main-here-7-8-public-static-void-displaysalestransacti-23045

using static System.Console; class SalesTransactionDemo { static void Main() { // Write your main here. } public static void Display(SalesTransaction s) { // Write your Display() method here } public static void DisplayTotal(SalesTransaction s) { // Write your DisplayTotal() method here } } Create an application named SalesTransactionDemo that declares several SalesTransaction objects and displays their values and their sum. The SalesTransaction class contains the following fields: - Name: The salesperson's name (as a string) - SalesAmount: The sales amount (as a double) - Commission: The commission (as a double) - RATE: A readonly field that stores the commission rate (as a double). Define a getRate() accessor method that returns the RATE. Include three constructors for the class. One constructor accepts values for the name, sales amount, and rate, and when the sales value is set, the constructor computes the commission as sales value times commission rate. The second constructor accepts a name and sales amount, but sets the commission rate to 0. The third constructor accepts a name and sets all the other fields to 0. An overloaded + operator adds the sales values for two SalesTransaction objects and returns a new SalesTransaction object.

Akash M.


*

Recommended Textbooks

-
Computer Science and Information Technology

Computer Science and Information Technology

Trishna Knowledge Systems 2018 Edition
achievement 1,355 solutions
Introduction to Programming Using Python

Introduction to Programming Using Python

Y. Daniel Liang 1st Edition
achievement 1,697 solutions
Computer Science - An Overview

Computer Science - An Overview

Glenn Brookshear, Dennis Brylow 12th Edition
achievement 1,719 solutions

*

Transcript

-
00:01 Hello, here we are with the answers to the given question.
00:02 Let's start the discussion.
00:04 In this context, we are dealing with several scenarios.
00:09 The first scenario is to test.
00:11 So to test, we do have to deal with the customer class, the code in the main class.
00:19 So go for the command public static void.
00:25 And this would give the main command is equal to create new customer object.
00:42 You can call read input method also here.
00:47 Also you could go for the write output method.
00:52 Secondly, we deal with add.
00:56 Here in order to add also we have to go for the methods and the methods that we have to give here would involve private boolean.
01:07 Private boolean has same name...
Need help? Use Ace
Ace is your personal tutor. It breaks down any question with clear steps so you can learn.
Start Using Ace
Ace is your personal tutor for learning
Step-by-step explanations
Instant summaries
Summarize YouTube videos
Understand textbook images or PDFs
Study tools like quizzes and flashcards
Listen to your notes as a podcast
Continue solving this problem
Create a free account to:
  • View full step-by-step solution
  • Ask follow-up questions with Ace AI
  • Save progress and study later
Continue Free
Numerade

Get step-by-step video solution
from top educators

Continue with Clever
or



By creating an account, you agree to the Terms of Service and Privacy Policy
Already have an account? Log In

A free answer
just for you

Watch the video solution with this free unlock.

Numerade

Log in to watch this video
...and 100,000,000 more!


EMAIL

PASSWORD

OR
Continue with Clever