Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete below java code to GUI part with netBeans (clearly for each class) with delete , update add , for each product : The name

Complete below java code to GUI part with netBeans (clearly for each class) with delete , update add , for each product :

The name of this task is CakeBank

// create class Cake

package cakebank;

public class Cake {

String name; double rate; public Cake() { name=""; rate=0; } public Cake(String n,double r) { name=n; rate=r; } public String getName() { return name; } public double getRate() { return rate; } public void setName(String n) { name=n; } public void setRate(double r) { rate=r; } public double price() { return rate; } public String toString() { return "Name : "+name+" Rate : "+rate; } }

// Create Class OrderCake

package cakebank;

public class OrderCake extends Cake{

double weight; public OrderCake() { name=""; rate=0; weight=0; } public OrderCake(String n,double r,double w) { name=n; rate=r; weight=w; } public void setWeight(double w) { weight=w; } public double getWeight() { return weight; } public double price() { return weight*rate; } public String toString() { return "Name : "+name+" Price : "+weight*rate; } }

// Create Class ReadyMadeCake

package cakebank;

class ReadyMadeCake extends Cake{ int quantity; public ReadyMadeCake() { name=""; rate=0; quantity=0; } public ReadyMadeCake(String n,double r,int q) { name=n; rate=r; quantity=q; } public void setQuantity(int q) { quantity=q; } public double getQuantity() { return quantity; } public double price() { return quantity*rate; } public String toString() { return "Name : "+name+" Price : "+quantity*rate; } }

// Create Class PlaceOrder

// This class also contains the main class

package cakebank; import java.util.Scanner;

public class PlaceOrder {

public static void main(String[] args) { Cake[] arr=new Cake[20]; int i=0; Scanner sc=new Scanner(System.in); String opt; String n; double r; double q; int q2; double totalPrice=0; double readyMadePrice=0; double maxPrice=-1; int maxIndex=0; while(i<1){ System.out.println("Welcome To CAKEBANK"); System.out.println("BEST PLACE TO FIND CAKES"); System.out.println("Enter type of cake from below menu(1 or 2) for cake number "+(i+1)); System.out.println("1.Order on Choice"); System.out.println("2.Select from already avilable cakes!"); opt=sc.next(); if(opt.equals("1")) { System.out.println("Enter name of cake");

sc.nextLine(); n=sc.nextLine(); System.out.println("Enter rate of cake"); r=sc.nextDouble(); System.out.println("Enter Number of cake"); q=sc.nextDouble(); arr[i]=new OrderCake(n,r,q); totalPrice=totalPrice+arr[i].price(); if(maxPrice

} else if(opt.equals("2")) { System.out.println("Available Choices"); System.out.println("Dark Choclate"); System.out.println("Strawberry"); System.out.println("Blueberry"); System.out.println("White Choclate"); System.out.println("Enter name of cake"); sc.nextLine(); n=sc.nextLine(); System.out.println("Enter rate of cake"); r=sc.nextDouble(); System.out.println("Enter quantity of cake"); q2=sc.nextInt(); arr[i]=new ReadyMadeCake(n,r,q2); totalPrice=totalPrice+arr[i].price(); readyMadePrice=readyMadePrice+arr[i].price(); if(maxPrice

}

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

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago