Irum Feroz

All generations.

translateFri, 07 Apr 2023

write a program in which use the inheritance and design the pizza menu

class Pizza { String pizza_name; int price; Pizza(this.pizza_name, this.price); void showInfo() { print('Pizza name: $pizza_name,\t price: $price'); } } class PizzaWithExtraCheese extends Pizza { int extraCheese_price; PizzaWithExtraCheese(String pizza_name, int price, this.extraCheese_price) : super(pizza_name, price); @override void showInfo() { print( 'Pizza name: $pizza_name,\t price: $price,\t extra cheese price: $extraCheese_price '); } } class PizzaWithExtraToppings extends Pizza { int toppings_price; PizzaWithExtraToppings( String pizza_name, int price, this.toppings_price) : super(pizza_name, price); @override void showInfo() { print(

Dart
View
translateFri, 07 Apr 2023

write a full program in which use the inheritance and design the pizza menu

class Pizza { final String name; final double price; final String image; Pizza(this.name, this.price, this.image); } class MyHomePage extends StatefulWidget { @override _MyHomePageState createState() => _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> { List<Pizza> pizzas = [ Pizza("Peperoni", 10.90, "https://capparellis.com/wp-content/uploads/2018/04/pepperoni-pizza.jpg"), Pizza("Margherita", 8.80, "https://bigseventravel.com/wp-content/uploads/margherita-pizza.jpg"), Pizza("Hawaiian", 9.80, "https://www.pizzeriacasanova.com/wp-content/uploads/2019/04/hawaii.png"), Pizza("Capparelli's Special", 13.00, "

Dart
View

Questions about programming?Chat with your personal AI assistant