subject

SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN JAVA. Assume that the classes listed in the Java Quick Reference have been imported where appropriate.
Unless otherwise noted in the question, assume that parameters in method calls are not null and that methods are called only when their preconditions are satisfied.
In writing solutions for each question, you may use any of the accessible methods that are listed in classes defined in that question. Writing significant amounts of code that can be replaced by a call to one of these methods will not receive full credit.

The following class represents a customer. The variable name represents the name of the customer, and the variable currAccNum represents the customer’s account number. Each time a Customer object is created, the static variable nextAccNum is used to assign the customer’s account number.

public class Customer

{

private static int nextAccNum = 1;

private String name;

private int currAccNum;

public Customer(String n)

{

name = n;

currAccNum = nextAccNum;

nextAccNum++;

}

}

(a) Write a method for the Customer class that that will return a string representing a bill notice when passed a double value representing an amount due.

For example, if the customer has name "Jeremiah", has account number 3, and has amount due 50.50, the method should return a string in the following format.

Jeremiah, account number 3, please pay $50.50

Write the method below. Your implementation must conform to the example above.

(b) Write a method for the Customer class that returns the value of the next account number that will be assigned.

Write the method below.
(c) A student has written the following method to be included in the Customer class. The method is intended to update the name of a customer but does not work as intended.

public void updateName(String name)

{

name = name;

}

Write a correct implementation of the updateName method that avoids the error in the student’s implementation.

Write the method below.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 06:50
Match the personality traits with their description
Answers: 1
question
Computers and Technology, 22.06.2019 07:00
You will be given two character arrays of the same size, one will contain a number of ships. ships will move around the character array based on which way they are facing and the route they are on. routes are given in the other array. the route consists of '-' and '|' for straight paths, '\' and '/' for curves, and '+' for intersections. there are ships on these routes. ships always face a direction, '^' for up, '> ' for right, 'v' for down, and '< ' for left. any time the ships hit a '\' or a '/' it will turn as you would expect a ship to turn (e.g. a '^' that moves into a '/' will turn right). at an intersection, ships will always continue straight through. all ships move at the same speed, ships take turns moving and all ships move during one 'tick'. the one in the most top left goes first, followed by those to its right, then the ones in the next row. it iterates along the rows and then down the columns. each ship moves one space on its turn moving along the route. your function needs to return the position of the first collision between two ships and the number of ticks before the crash occurred.
Answers: 2
question
Computers and Technology, 22.06.2019 08:00
Aplan to budget time for studying and activities is referred to as a study routine. study habits. study skills. a study schedule.
Answers: 1
question
Computers and Technology, 23.06.2019 07:50
Most shops require the technician to enter a starting and ending time on the repair order to track the actual time the vehicle was in the shop and closed out by the office. this time is referred to as _ time ? a. comeback b. ro c. cycle d. lead
Answers: 1
You know the right answer?
SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN JAVA. Assume that the class...
Questions
question
Law, 23.04.2021 05:30
question
Mathematics, 23.04.2021 05:30
question
Mathematics, 23.04.2021 05:30
question
Social Studies, 23.04.2021 05:30
question
English, 23.04.2021 05:30
question
Computers and Technology, 23.04.2021 05:30
Questions on the website: 13722362