Questions
This problem is about java program and please show the detail comment and code in each...

This problem is about java program and please show the detail comment and code in each class. Thank you!

Create four classes with the following UML diagrams:

(The "-" means private and the testBankAccount() testMobilePhone() testChocolate() testStudent() all static
+-----------------------------+
| BankAccount |
+-----------------------------+
| - money: int |
+-----------------------------+
| + BankAccount(int money) |
| + getMoney(): int |
| + setMoney(int money): void |
| + testBankAccount(): void |
+-----------------------------+
+------------------------------------------------+
| MobilePhone     |
+------------------------------------------------+
| - number: int |
| - account: BankAccount |
+------------------------------------------------+
| + MobilePhone(int number, BankAccount account) |
| + getNumber(): int |
| + payMoney(int amount): boolean |
| + testMobilePhone(): void |
+------------------------------------------------+
A mobile phone has a phone number and is connected to a bank account. The owner of the mobile phone can use the mobile phone to pay money: if amount is not negative and if the bank account connected to the mobile phone has enough money in it then the money in the bank account is decreased by amount and the payMoney method must return true, otherwise nothing changes for the bank account and the method must return false.
+-----------------------------+
| Chocolate |
+-----------------------------+
| - weight: double |
+-----------------------------+
| + Chocolate(double weight) |
| + getWeight(): double |
| + buy(int money): void |
| + eat(double amount): void |
| + testChocolate(): void |
+-----------------------------+
If the constructor of the Chocolate class is given a negative weight as argument then the weight must be changed to
0.0 Kg.
When buying chocolate, the weight of chocolate increases, with the price of chocolate being RMB 100 per 1.5 Kg. It is
not possible to buy a negative amount of chocolate, so in that case the buy method must print a message "Cannot
buy negative amount of chocolate
" and nothing else happens.
It is not possible to eat more chocolate than there is chocolate, so in that case the eat method must print a message
"Cannot eat nonexistent chocolate, only XXX Kg available" (where XXX is replaced with the current weight of chocolate) and nothing else happens.
+-----------------------------------+
| Student |
+-----------------------------------+
| - name: String |
| - phone: MobilePhone |
| - chocolate: Chocolate |
+-----------------------------------+
| + Student(String name, int money) |
| + getName(): String |
| + getChocolateWeight(): double |
| + hungry(int money): void |
| + testStudent(): void |
+-----------------------------------+
When a student is created, the student has 0.0 Kg of chocolate and a mobile phone which is connected to a bank
account with money in it. Use your student ID number as the phone number for the mobile phone.
When the student is hungry, the student first tries to use the mobile phone to pay the money amount. If the payment is
successful then the student buys the chocolate corresponding to the same money amount of the payment and then the
student eats half of the weight of chocolate that has just been bought (not half of the total weight of chocolate). If the
payment is not successful then the hungry method must print a message "Student is still hungry!" and
nothing else happens.
Each class has a static test method that contains tests for all the constructors and all the methods of the class. For each
class, test the simple methods first and the more complicated methods next. For each constructor and each method,
make sure that you test every possible case.
Add to your software a Start class with a main method that calls the test method of each of the four classes, to test
everything in your software.

In: Computer Science

Implementing IPv4 and IPv6 Addressing .

Implementing IPv4 and IPv6 Addressing

.

In: Computer Science

When a kernel thread dies, what OS data structures are updated?

When a kernel thread dies, what OS data structures are updated?

In: Computer Science

Consider the University Admission Process case description below In order to apply for admission, students first...

Consider the University Admission Process case description below In order to apply for admission, students first fill in an online form. Online applications are recorded in an information system to which all staff members involved in the admissions process have access. After a student has submitted the online form, a PDF document is generated and the student is requested to download it, sign it, and send it by post together with the required documents, which include: • certified copies of previous degree and academic transcripts • results of English language test • curriculum vitae • two reference letters When these documents are received by the admissions office, an officer checks the completeness of the documents. If any document is missing, an email is sent to the student. The student has to send the missing documents by post. Assuming the application is complete, the admissions office sends the certified copies of the degrees to an academic recognition agency, which checks the degrees and gives an assessment of their validity and equivalence in terms of local education standards. This agency requires that all documents be sent to it by post, and that all documents be certified copies of the originals. The agency sends back its assessment to the university by post as well. Assuming the degree verification is successful, the English language test results are then checked online by an officer at the admissions office. If the validity of the English language test results cannot be verified, the application is rejected (such notifications of rejection are sent by email). Once all documents of a given student have been validated, the admissions office forwards these documents by internal mail to the corresponding academic committee responsible for deciding whether to offer admission or not. The committee makes its decision based on the academic degrees and transcripts, the CV, and the reference letters. The committee meets once every three months to examine all applications that are ready for academic assessment at the time of the meeting. At the end of the committee meeting, the chair of the committee notifies the admissions office of the selection outcomes. This notification includes a list of admitted and rejected candidates. A few days later, the admissions office notifies the outcome to each candidate via email. Additionally, successful candidates are sent a confirmation letter by post. What steps can you extract from this process? Classify these steps into VA, BVA, and NVA.

In: Computer Science

In a few paragraphs There are 2 very different view components that are commonly used in...

In a few paragraphs

There are 2 very different view components that are commonly used in Express; Jade and Handlebars. Briefly describe which of these two you would prefer to use and why.

In: Computer Science

3. Please complete the example given in lecture; Programs to display pyramid and inverted pyramid using...

3. Please complete the example given in lecture;
Programs to display pyramid and inverted pyramid using * or # and digits

*
* * *
* * * * *
* * * * * * *
* * * * * * * * *

Press “1” button add 1 into the pyramid.
Press “1” to move number 1 to next cell (if it is the end of the triangle, loopback)
Press “2” to move number 1 to previous cell (if it is the end of the triangle, loopback)

First press
1
* * *
* * * * *
* * * * * * *
* * * * * * * * *
Second press
*
1 * *
* * * * *
* * * * * * *
* * * * * * * * *
Eighth press
*
* * *
* * * 1 *
* * * * * * *
* * * * * * * * *

Please write in cpp

In: Computer Science

Installing and Configuring DNS Servers

Installing and Configuring DNS Servers

In: Computer Science

Research Lab Do online research and Describe the ethical and legal issues in information systems security....

Research Lab
Do online research and Describe the ethical and legal issues in information systems security. It should not exceed 1 page

In: Computer Science

Java How to Program Exercise 4.11 Explain what happens when a Java program attempts to divide...

Java How to Program Exercise 4.11
Explain what happens when a Java program attempts to divide one integer by another. What happens to the fractional part of the calculation? How can you avoid that outcome?

My instructor want me to do that exercise with these details and I am so confuse. I don't know where to start.
"Random number of Trips"
"Enter gallon and miles as whole numbers"
"NPG decimal number"

In: Computer Science

In a few paragraphs what are the pros and cons on the usefulness of open source...

In a few paragraphs what are the pros and cons on the usefulness of open source projects. Specifically speaking about QA

In: Computer Science

Answer each question. 250 words max. with the source of the answer - What IT function...

Answer each question. 250 words max. with the source of the answer

- What IT function impacts user satisfaction the most?

What would you do to ensure high user satisfaction?

In: Computer Science

Java Write a program that reads 4 integer numbers from the user combine it into a...

Java

Write a program that reads 4 integer numbers from the user combine it into a single number. You need to ask the user to first specify how to combine the numbers (forward or backward). Note that for the backward option you need to check that the last digits should be 0, also for the forward option you need to check that the fist digit is not 0. Use for loops and switch for the menu.                       4. Write an application that prompts the user to enter an integer limit and then print the numbers from 1 to this limit in the following format. The number read should not be greater than 10 and should not be negative.        Enter a number: 3 Enter a number: 6 Enter a number: 2 Enter a number: 0 1.Forward 2.Backward Choose an option: 1 The number is 3620 Enter a number: 3 Enter a number: 6 Enter a number: 2 Enter a number: 0 3.Forward 4.Backward Choose an option: 2 Error!

In: Computer Science

Create your own function in C that accepts one input number and returns a double number....

Create your own function in C that accepts one input number and returns a double number. The themes for the functions should be one of the following: Calculates 3.14 times of the square of input number. For example, if 2 is input then 12.56 should be returned. (e.g. 3.14*2*2 = 12.56)

In: Computer Science

Do online research and Describe the ethical and legal issues in information systems security. It should...

Do online research and Describe the ethical and legal issues in information systems security. It should not exceed 1 page

In: Computer Science

The solution should be written in Java. Your POSmain program should take three file names from...

The solution should be written in Java.

Your POSmain program should take three file names from command line arguments. The first file contains a list of products and their prices; the second and third files are lists of items in two shopping carts of two customers. The POSmain program should first read the price file, then read each of the cart files to load a list of items in a shopping cart and store them in a ShoppingCart objects. The price file may contain a variable number of products and the cart files may contain a variable number of items.
POSmain then will create a CashRegister object by passing the price list to it. The POSmain program then will use the CashRegister object to scan items in a cart and print a receipt for each shopping cart one by one. At last, POSmain will use the CashRegister object to print a report for the day.
The students of CSIT111 and CSIT811 will print a different report for the day, which requires different design of your CashRegister class.

The output should be like this:-

One customer is checking out ...
========================================
Product Price Qty Subtotal
----------------------------------------
Bed $499.99 2 $999.98
Char $45.49 4 $181.96
TV $999.99 1 $999.99
Table $199.0 2 $398.0
-------------------------
Total $2579.93
========================================
One customer is checking out ...
========================================
Product Price Qty Subtotal
----------------------------------------
Bread $1.75 2 $3.5
Butter $2.84 1 $2.84
Ham $2.5 1 $2.5
Lettuce $1.0 1 $1.0
Milk $3.0 2 $6.0
Onions $0.54 3 $1.62
Tomato $0.76 5 $3.8
-------------------------
Total $21.26
========================================
Report for the day
========================================
Number of customers: 2
Total sale: $2601.19
List of products sold:
----------------------------------------
Product Qty
----------------------------------------
Bed 2
Bread 2
Butter 1
Char 4
Ham 1
Lettuce 1
Programming Fundamentals - 3/4 -
Milk 2
Onions 3
TV 1
Table 2
Tomato 5

In: Computer Science