CODE:
Restaurant class:
class Restaurant
{
private int seats;
protected String name;
Restaurant(int seats,String name)
{
this.seats = seats;
this.name = name;
}
public int getSeats()
{
return seats;
}
public void setSeats(int seats)
{
this.seats = seats;
}
public String toString()
{
return name+"\n"+seats;
}
}
FastFood class:
class FastFood extends Restaurant
{
private String slogan;
FastFood(int s,String n,String sl)
{
super(s,n);
slogan = sl;
}
public String getSlogan()
{
return slogan;
}
public void setSlogan(String s)
{
slogan = s;
}
public void increaseSeats(int s)
{
int x = super.getSeats();
x = x + s;
super.setSeats(x);
}
public String toString()
{
return super.name+" - "+slogan+"\n"+super.getSeats()+"\n";
}
}
FastFoodDemo class:
import java.util.*;
class FastFoodDemo
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int s = sc.nextInt();
sc.nextLine();
String n = sc.nextLine();
String sl = sc.nextLine();
int inc = sc.nextInt();
FastFood ob = new FastFood(s,n,sl);
ob.increaseSeats(inc);
System.out.println(ob);
}
}
OUTPUT:
In the right image, blue text is input and black text is output.

Create a class called Restaurant that is the base class for all restaurants. It should have...
program is C#
Design a restaurant class to help manage multiple restaurants and their menus equiremen The class contains: 1) A static int variable named storeCounter that starts at 1 and increments for each new restaurant item that is created 2) A string array called Menu 3) An int variable called StoreID 4) A Boolean variable called isOpen 5) A no-argument constructor that performs the following a. Sets storelD to storeCounter, then increments storeCounter b. Sets isOpen to true c....
Course Class Create a class called Course. It will not have a main method; it is a business class. Put in your documentation comments at the top. Be sure to include your name. Course must have the following instance variables named as shown in the table: Variable name Description crn A unique number given each semester to a section (stands for Course Registration Number) subject A 4-letter abbreviation for the course (e.g., ITEC, PHED, CHEM) number A 4-digit number associated...
java
Generics Objectives: OOWorking with a Generic Class 1. Create a class called Node that is Generic. The class has one class attribute that is an element. It will need 2 Constructors, a setter and getter for the class attribute, and a toString method. 2. Write a Lab10Driver that will: Instantiate a Node Integer object with no value. I. Il. Ill. IV. a. Then call the set method to set the value to 5. Instantiate a Node String object with...
Use inheritance to create a new class AudioRecording based on Recording class that: it will retain all the members of the Recording class, it will have an additional field bitrate (non-integer numerical; it cannot be modified once set), its constructors (non-parametrized and parametrized) will set all the attributes / fields of this class (reuse code by utilizing superclass / parent class constructors): Non-parametrized constructor should set bitrate to zero, If arguments for the parametrized constructor are illegal or null, it...
CS1180 Lab 9 Students will learn how to create a user-defined class. Part 1. Create a user-defined class. 1. Follow the UML diagram below to create a user-defined class, Automobile When implementing the constructors, use the default value of 0 for numeric types and "unknown" for VehicleMake and VehicleModel when not given as a parameter Implement the toString method in a format ofyour choosing, as long as it clearly includes information for all four member variables Make sure to include...
Create a NetBeans project called "Question 1". Then create a public class inside question1 package called Author according to the following information (Make sure to check the UML diagram) Author -name:String -email:String -gender:char +Author(name:String, email:String, gender:char) +getName():String +getEmail):String +setEmail (email:String):void +getGender():char +tostring ):String . Three private instance variables: name (String), email (String), and gender (char of either 'm' or 'f'): One constructor to initialize the name, email and gender with the given values . Getters and setters: get Name (), getEmail() and getGender (). There are no setters for name and...
Problem 5: Monster Factory (10 points) (Game Dev) Create a Monster class that maintains a count of all monsters instantiated and includes a static method that generates a new random monster object. In software engineering, a method that generates new instances of classes based on configuration information is called the Factory pattern. UML Class Diagram: Monster - name: String - health: int - strength: int - xp: int + spawn(type:String): Monster + constructor (name: String, health: int, strength: int, xp:...
All question base on Java Se
8
Consider the Top class i public abstract class Topí 2 private 3 protected String name; 4 public intx - 12; int age; e public Top(String name)[ this.namename age0; System.out.println(x); 10 12 public abstract void foo(String f); 13 Create a Middle class that extends the Top class. The class should have a single constructor that takes two input parameters: a String (for name) and int (for age). Your constructor should not have any redundant...
Thank you in advance. Create a class called Main and write the main method. I need help with calling the printChart method Declare a variable to hold the grade as it is read in Declare 5 variables to hold counts to count the number of As, Bs, Cs, etc declare a variable to hold the class name and ask the user to enter the name of the class whose grades are going to be entered. Write a loop that reads...
Assignment Requirements
I have also attached a Class Diagram that describes the
hierarchy of the inheritance and interface behaviors . The link to
the PDF of the diagram is below
MotorVehical.pdf
Minimize File Preview
User Define Object Assignment:
Create a Intellij Project. The
Intellij project will contain three user defined
classes. The project will test two of the User Define Classes by
using the invoking each of their methods and printing the
results.
You are required to create three UML...