(a) Write the cinema class that contains two private data: one to hold cinema location and the other to hold the number of seats in cinema. (b) Write the constructor foe the class that takes two parameters to set the location and the number of seats.
Q: write a program to print the area and perimeter of a triangle having sides of 3 4 and 5 units by…
A: As no programming language is mentioned, it is solved using basic C++
Q: Declare a class named Vehicle as a base class with two data members model (string) and year (int).…
A: Introduction: In this question, we are asked to declare two classes only that are Vehicle(base…
Q: Object composition is useful for creating an Is-A relationship between classes. is it True or…
A: Object composition is useful for creating an Has-A relationship between classes. A Has-A…
Q: __________ is the default behavior when an object is assigned the value of another object of the…
A: Ans:- memberwise assignment
Q: Write a class named Employee that has the following member variables: name. A string that holds the…
A: #include <iostream>#include "Employee.h" using namespace std; int main(){ //create 3…
Q: Create a class car with make, model, year, OwnerName, RegisNo, Insurers as private fields. Create…
A: We have to define a class Car and it's data member and member functions.
Q: program to create a Distance class containing kilometers and Meter as data
A: Program: // C++ Version 14#include <iostream>using namespace std;// Distance Classclass…
Q: Write a class having two private variables and one member function which will return the area of the…
A: The asked C++ program code is coded in the next step and is explained by using comments.
Q: Write a program to create a room class, the attributes of this class is roomno, roomtype, roomarea…
A: Since no programming language is mentioned, I am using java. Code: class Room{ int roomno;…
Q: It is possible for a class to have more than one constructor. A) This is correct. B) The answer is…
A: Task :- Choose the correct option for given statement about constructors.
Q: Create a class called Distance that has two data member feet as int type and inches as float type.…
A: A constructor is a special member of a class that has the same name as the class name. The default…
Q: You are creating a program to make Cars. Each Car has an Engine, which is declared as a separate…
A: Required code provided in below:
Q: Create a class Date, with data members Day, Month and year. . Overload the constructor in Date, and…
A: class Date { Public: Date( string )…
Q: Question 19 Private fields are variables that class users can access but member methods can not.…
A: Answer for question 17 is option A i.e. java.lang.Object Explanation- All classes in java are…
Q: Create two classes named Mammals and MarineAnimals. Create another class named BlueWhale which…
A: PROGRAM STRUCTURE: Include the required header files. Write the definition of the class for the…
Q: In this exercise, you will design various classes and write a program to computerize the billing…
A: Actually, program is a executable software that runs on a computer.
Q: QUESTION 2 Create an instance of the Time class called time1. It should have an initial time with…
A: The Answer is in step2
Q: You are in process of writing a class definition for the class Book. It has three data attributes:…
A: The initializer method in Python is the __init__() method. First we have to pass the self parameter.…
Q: Create two classes manager and employee which store (code, name, salary, department, and city).find:…
A: Step 1 : Start Step 2 : Create 2 Classes manager and employee Step 3 : Declare their Data members.…
Q: You are in process of writing a class definition for the class Book. It has three data attributes:…
A:
Q: Moving to another question will save this response. tion 3 inside a class, variables are private by…
A: Answer : False.
Q: Now, create an object for each of the above class and try calling 1 - function of Mammals by the…
A: Program Explanation: Define the header files Define a class for Mammals Define a function to…
Q: Write a program to create a class named 'agecalculator', containing variable 'year', 'month'. Create…
A: #include <iostream>using namespace std;//creating class agecalculatorclass agecalculator{…
Q: Create two classes manager and employee which store (code, name, salary, department, and city).find:…
A: Class is a user-defined data type that encapsulates the data members and member functions/methods as…
Q: The reference this can be used to refer to an object or to invoke another constructor of the same…
A: This question comes from Programming Language which is a paper of computer science. Let's discuss it…
Q: Given main(), complete the Food Item class (in files Food Item.h and Foodltem.cpp) with constructors…
A: The complete Solution in C++ Programming Language is below. The Answer Contains: 1. FoodItem.h 2.…
Q: Q1: Define a class named Person that contains the data fields for the first name and last name.…
A: let us see the answer:- Introduction:- A class is an object's blueprint. A class can be compared to…
Q: The following is the constructor for the class Faculty. This class has one attribute which is String…
A: Given: The following is the constructor for the class Faculty. This class has one attribute which…
Q: ________________applies to a class rather than an object?
A: Given: ________________applies to a class rather than an object?
Q: a. Create a class called Building that has three private data members: name (String), number of…
A: class Building{ //Building has 3 private members name, flats, roomsPerFlat private String name;…
Q: O Challenge task Write the code of the Constructors and Distructor for the following class 1-Write…
A: Include header files Define a class with class name constructor and data member X and Y as integers…
Q: A single class can have many instances of that class it’s true or false
A: The answer is...
Q: Suppose that the class Pet has a field called name that is of the type String. Write an assignment…
A: public Pet(String petsName) { } This is the constructor of class Pet. It accepts one argument of…
Q: Create a "house" class that initializes house objects in the following way :…
A: """Program to create a class house, intialze it, get user monthly saving and display monthsneeded to…
Q: What happens if you write a class with no constructor whatsoever?
A: A constructor is a special method of a class for creating and initializing objects of that class.
Q: iven a class named student, which of the following is a valid constructor declaration for the class?…
A: Given a class named student, which of the following is a valid constructor declaration for the…
Q: Write a class called Bicycle, which contains two attributes, gear, which describes the type of gear…
A: Begin Declare gear and speed in Bicycle class Declare seatHeight in MountainBike class Create an…
Q: Write a program to create a class BOX with data member length, width and height method volume and…
A: Program is
Q: I have multiple constructors defined in a class. Is it possible to call a constructor from another…
A: INTRODUCTION: A constructor is a specific sort of subroutine used to build an object in class-based…
Q: You are in process of writing a class definition for the class Book. It has three data attributes:…
A: 1) Below is program that Creates a Book Class with initializer method and private attributes title,…
Q: Write the statement to declare the constructor with two parameters and assign the values by creating…
A: In this question, we have to write the statement to declare the constructor with two parameters and…
Q: 1. Design a class named Meeting with the following • location data field from type String and…
A: Code public class Main{ public static void main(String[] args) { Meeting s1 = new Meeting("Room…
Q: 1- Design a class named Fan to represent a fan. The class contains: -Three constants named SLOW,…
A: class Fan{public static final int SLOW=1,MEDIUM=2,FAST=3;int speed;boolean f_on;double radius;String…
Q: a. Instance of a class is called, functions have same name but different sets of parameters.
A: a) Object. A class act as a blueprint or template to make the objects with the same structure but…
Q: 1) Create a class Coffee that contains 2 fields coffeeType of type String and coffeePrice of type…
A: In c++, Class is a user-defined data type, which holds its own data members and member functions,…
Q: The Constructors with all the default arguments are similar as default constructors. True or False
A: Question. The Constructors with all the default arguments are similar as default constructors. -…
Q: In this exercise, you will design various classes and write a program to computerize the billing…
A: Actually, java is a object oriented programming language. It is a platform independent.
Q: Write a program that use class called student contains the following members: 1. id number of…
A: ALGORITHM:- 1. Create Student class. 2. Declare private variables for storing student details. 3.…
(a) Write the cinema class that contains two private data: one to hold cinema location and the other to hold the number of seats in cinema.
(b) Write the constructor foe the class that takes two parameters to set the location and the number of seats.
Code :
import java.util.*;
import java.lang.*;
import java.io.*;
public class Cinema
{
private String location;//decalring location variable to store location of cinema
private int noOfSeats;//decalring noOfSeats variable to store no. of seats of cinema
Cinema(String l,int n)//constructor to initialize location and no. of seats in Cinema
{
location=l;
noOfSeats=n;
}
public static void main (String[] args) throws java.lang.Exception
{
Cinema ob=new Cinema("Kolkata,India",240);//Object is created
System.out.println("Location: "+ob.location+"\nNo.Of Seats: "+ob.noOfSeats);//printing the values
}
}
Screenshot :
Step by step
Solved in 4 steps with 2 images
- In C++, Create a class called Date that includes three data members: amonth(type int), a day(type int), and a year(type int). The Date class willhave a constructor with three parameters to initialize the three data members.You may assume the values provided for the year and day are correct, but makesure that the month value is in the range 1-12; if it isn't, set the month to1. Provide set and get functions for each data member. Provide a memberfunction displayDate that displays the date in format MM/DD/YYYY.Write a test program that prompts the user to input the month, the day,and the year and uses your Date class to output the formatted date.Design a class that holds the following personal data: name, address, age, and phone number. Write appropriate accessor and mutator methods. Also, write a program that creates three instances of the class. One instance should hold your information, and the other two should hold your friends’ or family members’ information.Create a class called Date that includes three pieces of information as data members—a month (type int ), a day (type int ) and a year (type int ). Your class should have a constructor with three parameters that uses the parameters to initialize the three data members. For the purpose of this exercise, assume that the values provided for the year and day are correct, but ensure that the month value is in the range 1–12; if it isn’t, set the month to 1. Provide a set and a get function for each data member. Provide a member function displayDate that displays the month, day and year separated by forward slashes ( / ). Write a test program that demonstrates class Date ’s capabilities.
- Question 6 Create a set of classes and interface for the following scenario: Define an interface called Classical Music, which contains a get Year method that returns the year the classical album released. Create an abstract class Called CD. This class contains the title as String, and playingTime as integer (e.g. 60 minutes). Include a constructor to initialize all the data fields. Create an abstract method called printPlayingTime to show the CD playing details. Make sure all the data fields can be accessed directly from the child classes. Create a class called Album that inherits from the CD and Classical Music. Include a data field called year as integer type. Create a constructor to initialize all the data members. Override the getYear method to return the released year. Override the printPlayingTime method. If the CD title is more than 10 characters, this method will print the first 10 characters, followed by the three ellipse dots and the playing time. For example: Thriller 60…Write a shoe class with the following attributes: color (e.g., "blue", "green", "orange") displayName (e.g., "nikes, adidas", "puma") price (e.g., 100, 200,60) Include only one constructor. It should have parameters for each of the attributes and set their values. Additionally, include getters and setters for each of the attributes. Add a driver, name it Purchases, and create 2 objects. Finally, print out some information about both objects (i.e., print the information from some or all of the getters). For example, if you created a shoe object whose color was blue, whose display name was shoes , for a price of 230, you could use the getters to print something like this:These work trousers are blue and cost $230Language is Java Write a Clothing class with the following attributes: color (e.g., "blue", "green", "orange") displayName (e.g., "Doctor Who hoodie", "slacks") price (e.g., 19.99, 7) Include only one constructor. It should have parameters for each of the attributes and set their values. Additionally, include getters and setters for each of the attributes. Add a driver, name it Purchases, and create 2 Clothing objects. Finally, print out some information about both objects (i.e., print the information from some or all of the getters). For example, if you created a Clothing object whose color was blue, whose display name was work trousers, for a price of 27.99, you could use the getters to print something like this:These work trousers are blue and cost $27.99.Don't hardcode the print statement for full credit, you must use the getters
- The class "Car" has the following attributes: plate (String), mark (String), model (String), year (int), km (int).Write a constructor method for the "Car" class that takes values as parameters for all these attributes.constructor that sets all instance variable to a given values. instanc variables: Full name( service(int), monthly salary (double) Method to print information of the employee. B: Create a class called Employee that includes five pieces of information as: yearly salary for them.Design a class called Date that has integer data members to store month , day, and year. The class should have two constructors; a default constructor that accepts no parameters, and a three-parameter constructor that allows the date to be set by the programmer. If the user creates a Date object without passing any arguments, or if any of the values passed are invalid, the default values of 1, 1, 2001 (i.e., January 1, 2001) should be used. The class should have three (3) member functions to print the date in the following formats: 3/15/16 March 15, 2016 15 March 2016 Demonstrate the class by writing a program that uses it. Be sure your program only accepts reasonable values for month and day. The month should be between 1 and 12. The day should be between 1 and the number of days in the selected month. I expect to see all uses of the constructors that you made, including the error checking. I also expect to see all uses of the 3 output functions in your program. You are responsible…
- This is the question - Create a class named Rock that acts as a superclass for rock samples collected and catalogued by a natural history museum. The Rock class contains the following fields: sampleNumber - of type int description - A description of the type of rock (of type String) weight - The weight of the rock in grams (of type double) Include a constructor that accepts parameters for the sample number and weight. The Rock constructor sets the description value to "Unclassified". Include get methods for each field. Create three child classes named IgneousRock, SedimentaryRock, and MetamorphicRock. The constructors for these classes require parameters for the sample number and weight. Search the Internet for a brief description of each rock type and assign it to the description field using a method named setDescription inside of the constructor. I am only missing two checks and they seem to be with the rock, here is my code then I will copy one check - import java.util.*;…Design a LandTract class that has two fields (i.e. instance variables): one for the tract’s length(a double), and one for the width (a double). The class should have: a constructor that accepts arguments for the two fields a method that returns the tract’s area(i.e. length * width) an equals method that accepts a LandTract object as an argument. If the argument object holds the same data (i.e. length and width) as the calling object, this method should return true. Otherwise, it should return false. a toString method (that returns a String representation of the tract’s length, width, and area). Demonstrate the class in a program by creating an array of three LandTract objects initialized with user input. Then, print the info of the LandTract objects stored in the array by invoking the toString method (implicitly or explicity). Also, use the equals method to compare at least two LandTract objects and print wether they are of equal size or not. Sample Output:…This is the question - Create a class named Rock that acts as a superclass for rock samples collected and catalogued by a natural history museum. The Rock class contains the following fields: sampleNumber - of type int description - A description of the type of rock (of type String) weight - The weight of the rock in grams (of type double) Include a constructor that accepts parameters for the sample number and weight. The Rock constructor sets the description value to "Unclassified". Include get methods for each field. Create three child classes named IgneousRock, SedimentaryRock, and MetamorphicRock. The constructors for these classes require parameters for the sample number and weight. Search the Internet for a brief description of each rock type and assign it to the description field using a method named setDescription inside of the constructor. This is the code I have, the program does not like at all what I have - import java.util.*; public class DemoRock { public static…