Consider the association relationship between the class Customer in question 2 above and a class Invoice where the Customer class is a member of the Invoice class. Write the codes for the Invoice class and a test driver to test all the public methods
The Customer class models a customer using as shown in the class diagram below. Write the codes for the Customer class and a test driver to test all the public methods. Note that a discount is given as a percentage. The toString() method should output the customer information including the ID, name and discount
Create a class named Employee. Employees are identified by their employee number,
last name, first name and salary.
Create the necessary instance variables and methods for the class Employee.
In your main project, create at least five (5) employee records and display each record.
Employee’s data must be based on data entry from the user.
Encapsulation
Create a class for a point (that has an x-coordinate and a y-coordinate). Also, create another class called Rectangle. The Rectangle should have 2 points, the top left and the bottom right. You should also implement the following methods for the Rectangle:
display() - draws the rectangle on the console based on the sample
area() - computes and returns the area of a given rectangle
perimeter() - computes and returns the perimeter of a given rectangle
centerPoint() - computes and returns the center point of a given rectangle
isSquare() - checks whether a given rectangle is a square or not.
Input
A pair of numbers representing the points for the rectangle (x and y).
5 8
Output
The first few lines contain the drawn rectangle. After one empty line, the next line prints either "RECTANGLE" or "SQUARE". This is then followed by its area, perimeter, and the coordinates of its center point.
RECTANGLE
AREA:·40
PERIMETER:·26
CENTER·POINT:·(2.50,4.00)
Encapsulation
Construct a class called Term. It is going to represent a term in polynomial expression. It has an integer coefficient and an exponent. In this case, there is only 1 independent variable that is 'x'.
There should be two operations for the Term:
public Term times(Term t) - multiplies the term with another term and returns the result
public String toString() - prints the coefficient followed by "x^" and appended by the exponent. But with the following additional rules:
if the coefficient is 1, then it is not printed.
if the exponent is 1, then it is not printed ( the caret is not printed as well)
if the exponent is 0, then only the coefficient is printed.
Input
The first line contains the coefficient and the exponent of the first term. The second line contains the coefficient and the exponent of the second term.
1·1
4·3
Output
Display the resulting product for each of the test case.
4x^4
Write a program with total change amount in pennies as an integer input, and output the change using the fewest coins, one coin type per line. The coin types are Dollars, Quarters, Dimes, Nickels, and Pennies. Use singular and plural coin names as appropriate, like 1 Penny vs. 2 Pennies.
10-in-1
by CodeChum Admin
Troy who is in his 1st grade and is having a hard time learning how to count numbers from 0 – 50. He asked his brother Gabriel to teach him how to count, but he requested to do teach it 10 numbers per line. His brother don't know how to teach his brother so he looking for a friend who can help him. Can you help Gabriel to do a program that can teach Troy to count numbers by printing it 10 numbers per line? If the numbers exceed or is equal to 50, the output should display "Number must be below 50!".
Input
1. Size of Numbers
Description
The size of the numbers.
Constraints
The value is guaranteed to be a positive integer.
Sample
17
Output
The first line will contain a message prompt to input the size.
The succeeding lines will contain the numbers or the message required if the number is greater than 50.
Enter·size:·17
0·1·2·3·4·5·6·7·8·9
10·11·12·13·14·15·16
Write a java program that declares and displays a named constant that holds the number of seconds in a minute and a variable to represent the number of your subject. Name the class as DataStore and save the file. Debug syntax and logical errors if there any in the program.
Show the following in your testing section (supported by screen shots):
· 2 x successful execution of Add_money between one client and the server (two shots – one for the client, one for the server) with different clients (e.g., one example with A and one with B)
· 2 x successful execution of Subtract_money between one client and the server (two shots – one for the client, one for the server) with different clients (e.g., one example with A and one with C)
· 2x successful execution of Transfer_money between one client and the server (two shots – one for the client, one for the server) with different clients (e.g., one example with A transferring between A and B, one with C transferring between B and C)
Remember that these should show the connection, the protocol, correct locking and updates of relevant values.
Write a java program that declares and displays a named constant that holds the number of seconds in a minute and a variable to represent the number of your subject. Name the class as DataStore and save the file. Debug syntax and logical errors if there any in the program.