Java program that totals the number of cakes


Assignment Task 1: Order.java

Background - Task 1 - Order (do-while practice)

You are tasked with writing a program that totals the number of cakes ordered in a day.

Follow the steps to complete the task using the steps and information above. (Note indentation indicates that the indented parts are contained within the previous step. Eg. All steps within an if statement are indented)

1. The program prints to the screen the student name and student number. This is enclosed by triple asterisks. Ensure you follow the below format.

(Replace with your details)

2. The program asks the user for the order.

a. The order is a String in the format:

#TypeA#TypeB#TypeC

# Indicates the number of cakes from 1 - 9 that will be ordered of TypeX cake There are three types of cake (guaranteed):

Cheese Choc Butter

There may be one, two or three types of cakes in a single order Examples:

6Butter2Choc

6 Butter cakes, 2 Chocolate cakes 3Choc2Butter1Cheese

3 Chocolate cakes, 2 Butter cakes, and 1 Cheese cake

3. The program adds the number of cakes from the order to the total number of each type of cake

a. Note: The following methods will be helpful:

i. contains()

ii. indexOf()

iii. charAt()

b. To convert the character '1' to '9' into an integer value, follow the steps below:

i. Read the character at the index you want

ii. Subtract '0' from this character to get its integer value, and store appropriately

iii. Do not use any method that has not been covered.

4. The program asks the user if there are more orders (true or false)

5. If there are more orders return to step 2 (loop)

6. Print the total number of cakes

Assignment Task 2: Reciept.java

Background - Task 2 - Reciept (for, printf practice)

You are tasked with writing a program to find the orders in a file and then print the items and total price. The file contains all orders, you should not print them all.

1. The program prints to the screen the student name and student number. This is enclosed by triple asterisks. Ensure you follow the below format.

(Replace with your details)

2. The program then asks the user to enter a file name

3. The program opens the file with given file name

4. The program asks the user where the order starts

5. The program asks how many cakes were ordered

6. Using a loop, skip over the lines in the file to reach the start of the order.

a. Hint, you do not need to store the data

7. For the number of cakes:

a. Read the price as a double

b. Read the cake type as a String (May be any number of words)

c. Print the cake number starting from 1, cake type and the price (to two decimal places

8. Print the total price

Assignment Task 3: Decoration.java

You are tasked with writing a program to print the decoration for a cake

Follow the steps to complete the task using the steps and information above. (Note indentation indicates that the indented parts are contained or related to the previous step. Eg. All steps within an if statement are indented)

1. The program prints to the screen the student name and student number. This is enclosed by triple asterisks. Ensure you follow the below format.

(Replace with your details)

2. The program asks the user for the size of the cake as an integer

a. If the user enters a value less than 3, ask them to reenter until they enter a valid value

3. The program asks the user for the decoration on the cake as a char

4. The program should print a diamond using the decoration and size selected: Examples are shown in the output and should match your output:

This are only examples and any valid size should work The height is size*2-1

The width is size*2-1

Assignment Task 4: DecorationExtended.java

You are tasked with writing a program to extend the functionality off the previous task. The cake in this task has two decorations that alternate each line.

Further, the diamond is an outline, rather than solid.

Note: This task reuses parts from previous tasks

1. The program prints to the screen the student name and student number. This is enclosed by triple asterisks. Ensure you follow the below format.

(Replace with your details)

2. The program asks the user for the size of the cake as an integer

a. If the user enters a value less than 3, ask them to reenter until they enter a valid value

3. The program asks the user for the decoration on the cake as a char

4. The program asks the user for the second decoration on the cake as a char

5. The program should print a hollow diamond using the decorations and size selected: Examples are shown in the output and should match your output:

This is only examples and any valid size should work

The height is size*2-1

The width is size*2-1

It is always advisable to take online assistance from the Object-Oriented Programming Fundamentals Assignment Help service offered by Tutorsglobe, in order to make your academic life stress free.

Tags: Object-Oriented Programming Fundamentals Assignment Help, Object-Oriented Programming Fundamentals Homework Help, Object-Oriented Programming Fundamentals Coursework, Object-Oriented Programming Fundamentals Solved Assignments, JAVA Assignment Help, JAVA Homework Help, JAVA Coursework, JAVA Solved Assignments

Attachment:- Object-Oriented Programming Fundamentals.rar

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Java program that totals the number of cakes
Reference No:- TGS03026736

Expected delivery within 24 Hours