Design a class named Cake. Data fields include two string fields for cake flavor and icing flavor and numeric fields for diameter in inches and price. Include methods to get and set values for each of these fields. Create the class diagram and write the pseudocode that defines the class. Design an application that declares two Cake objects and sets and displays their values.

Respuesta :

Using the computer language in pseudocode to write a function code that  declares two Cake objects and sets and displays their values.

Writting the code in pseudocode:

- cake flavor: string

- icing flavor: string

-diameter: num

-price: num

+set cake flavor (cake flavor : string) : void

+set icing flavor (icing flavor: string) : void

+set Diameter(size : num) : void

+set Price(price : num) : void

+get cake flavor () : string

+get cing flavor () : string

+get Diameter() : num

+get Price() : num

Answer A=

Pseudocode:

class Cake

Declarations

private string cake flavour

private string icing flavor

private num diameter

private num price

public void set Cake flavour (string Cake flavour)this. Cake flavour = Cake flavour

return

public void set icing flavour (string icing flavour)this. icing flavour = icing flavour

return

public void set Diameter(num size)

diameter = size

return

public void set Price(num price)

this price = price

return

public string get Cake flavour ()

return Cake flavour

public string get icing flavour ()

return icing flavour

public num get Diameter()

return diameter

public num get Price()

return price

end Class

start

Declarations

Cake my Cake

Cake your Cake

myCake.set cake flavour (“chocalate”)

myCake.set icing flavour (“peppermint”)

myCake.setDiameter(15)

myCake.setPrice(18)

myCake.set cake flavour (“pineapple”)

myCake.set icing flavour (“orange ”)

yourCake.setDiameter(20)

yourCake.setPrice(25)

output “Cake 1 info:”

output myCake.get cake flavour ()

output myCake.get icing flavour ()

output myCake.getDiameter()

output myCake.getPrice()

output Cake 2 info:”

output yourCake.get cake flavour ()

output yourCake.get icing flavour ()

output yourCake.getDiameter()

output yourCake.getPrice()stop

See more about pseudocode at brainly.com/question/13208346

#SPJ1

Ver imagen lhmarianateixeira