Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are required to develop a Java project with NetBeans JFrame GUI facilities. This project contains two functions: 1. Water Tariff 2. Lily Bakery Shop

You are required to develop a Java project with NetBeans JFrame GUI facilities. This project

contains two functions:

1. Water Tariff

2. Lily Bakery Shop

Function 1: Water Tariff

For the first function it is almost similar as Assignment I. Except, this time you are required

to develop this with GUI Java framework. You should refer back to the assignment question

for the formula/calculation and rules.

All the calculations have to be done in new methods (you have to apply the method lesson

here; it might involves passing parameters and return value). All inputs and output should

be programmed inside the respective button methods (where they will call the respective

methods for the calculations)

code for the water tariff from previous assignment:

import java.util.*; import java.text.DecimalFormat; public class Main { public static void main(String[] args) { DecimalFormat df = new DecimalFormat("#.00"); //FOR FORMATTING THE TOTAL UPTO 2 DECIMAL PLACES Scanner sc = new Scanner(System.in); System.out.println("Enter user category 1.Non-Commercial 2.Commercial"); int ch=sc.nextInt(); //STORE USER INPUT FOR NON-COMMERCIAL OR COMMERCIAL System.out.print("Enter volume of water usage (in meter^3): "); double v=sc.nextDouble(); //STORE USER INPUT FOR VOLUME double tot=0.0; if(ch==1) //IF THE USER INPUT IS NON-COMMERCIAL { //CALCULATION AS PER THE GIVEN TABLE FOR NON-COMMERCIAL CATEGORY if(v>=0 && v=16 && v=41 && v=0 && v=21 && v

Function 2: Lily Bakery Shop

You are required to develop a program for Lily Bakery that will calculate the total price of

cake that need to be paid by customers. The price of cake depends on the flavor of cake as

the following example:

image text in transcribed

You should add the list of cakes to 10 options (10 type of cakes) with different prices. Store

all the cakes and their prices in arrays. You can directly initialize the cakes and its prices

directly to an array (you dont have to get/read the list from user).

First, the program will display a list of the cakes and their prices. You should put the list in a

table (retrieve them from the array). Then it requests user to choose the preferred cake

and its quantity. Next the price of the cake is calculated and displayed.

After that, the user is given option to add order. That mean the operations need to be done

repeatedly. If the user chooses to add order, the above operation is repeated. This will be

repeated until user finishes ordering. You can use another button to indicate that user has

already completed the order and want to pay the total price. Then the program will display

the grand total, prompt for the amount tendered and calculate the balance. At the end, the

bill will be displayed. All of the amount displayed in this program must be formatted to two

decimal points. You need to observe that this project has to include array, repetition and method.

You are required to use GUI as your user interface. This is a guide line (without GUI).

image text in transcribed

You should start with a menu jframe form/layout (your main layout), where you can ask

user to enter which function he/she wants to use. From that main menu, it will open other

layout based on what function user choose.

The layout design has to be neat.

Cakes New York Cheese Black Forest Cheese Red Velvet Fruitilicious Price (RM) 88.00 65.00 130.00 95.00 *** **** WELCOME TO LILY BAKERY Please choose your preferred cake: 1-New York Cheese 2-Black Forest Cheese 3-Red Velvet 4-Fruitilicious Enter your choice of cake: 3 Enter the quantity of cake : 2 Current total price : RM 260.00 Do you want to add your order?: 'Y' / 'N': Y * WELCOME TO LILY BAKERY ******* Please choose your preferred cake: 1-New York Cheese 2-Black Forest Cheese 3-Red Velvet 4-Fruitilicious Enter your choice of cake: 1 Enter the quantity of cake : 1 Current total price : RM 348.00 Do you want to add your order?: 'Y' / 'N': N Grand total : RM 348.00 Please enter amount tendered: RM 400 ** Your Bill: ***** Total price RM 348.00 Amount Tendered RM 400.00 Balance RM 52.00 [Note: you have to change this form of input/output by using Java GUI]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Principles Of Multimedia Database Systems

Authors: V.S. Subrahmanian

1st Edition

1558604669, 978-1558604667

More Books

Students also viewed these Databases questions

Question

2. Share student successes through notes or email messages.

Answered: 1 week ago

Question

Identify five strategies to prevent workplace bullying.

Answered: 1 week ago