1) Given the following completed class header: first, find all the errors, then state why the error exists, and finally provide a new line of code that will correct the error. Not all errors are syntax errors, some may be flawed implementation choices and thus would later become logical flaws and errors during actual class implementation. If a line has multiple errors, please use two boxes to state the error line and reason, but your new code may be the same in both boxes. You may or may not use all the provided error boxes. 1. PurplePeopleEater { 2. public: int eyeCount; Color monsterColor; bool horn; int peopleEaten; 9. private: 10. 11. 12. 3. 4. bool PurplePeopleEater::hasHorn(); void getEyeCount(); void setcolor(string); void consumePerson(); 5. 6. 13. 7. 14. // continues to the right 15. }; 8. Line #: Why does this line have an error?
Q: Define a class named Complex that will represent complex numbers. A complex number is a number of…
A: #include<bits/stdc++.h>using namespace std; class Complex { public: int real,…
Q: Match the correct answer to the question. The information passed to a method in its parenthesis is…
A: As per Bartleby's answering guidelines if there are more than one subparts of a question then we are…
Q: What is the output of the following code where Student is a subclass of Person class? Person s =…
A: The instanceof operator is used to test whether the object is an instance of the specified type…
Q: 1 You have studied encapsulation and inheritance that are two important concepts of Object- Oriented…
A: Introduction of Encapsulation and Inheritance Object-oriented programming's main features are an…
Q: Q2\A\ fill the blanks ( answer three) 1- The private part of Class called -------- and the public…
A: Here, I have to answer the above questions.
Q: The purpose of this exercise is to allow the student to demonstrate their understanding of…
A: The purpose of this exercise is to allow the student to demonstrate their understanding of…
Q: In which phase of program development would you expect the programmer(s) to determine the classes…
A: Explanation: Software requirements - in this phase only requirements are gathered. InCorrect…
Q: 1. Which SOLID principle would apply for the following statements? Justify your answer briefly. i.…
A: The question is on: which SOLID principle would apply for the following statements.
Q: There are common attributes and methods between kids and trainers. What is the best choice for…
A: Kid.java public class Kid { private static int idStatic=0;private int id;private String…
Q: Given the class definitions above, what is printed to the console when the following lines of code…
A: Given Code is using Inheritance in Java Inheritance: Classes have the capability to Derive…
Q: Write a program that would print the information (name, year of joining, salary, address) of three…
A: Code: class Employee{ private String name, address; private int year, salary; public…
Q: What is a class loader? Class vs. Object? What is a constructor?
A: According to the question we need to give clear explanations and code examples for each…
Q: II. Answer the following questions; provide appropriate explanations for your answer. 1. Every…
A: INTRODUCTION: We need to tell the ways inheritance promotes defect reduction.
Q: 5. How many parameters must be passed if only the following prototype is given to a constructor?…
A: Question 5. How many parameters must be passed if only the following prototype is given to a…
Q: Hello, I am trying to write a program: What is the role of a normal constructor? Create the class…
A: Hello, I am trying to write a program: What is the role of a normal constructor? Create the class…
Q: What is the role of a normal constructor? Create the class Student, which must have a normal…
A: A normal constructor is a constructor without any arguments. //this is an example of normal…
Q: The task should use the superclass constructor whenever possible, and respect the good practice of…
A: IN question our task is to create a super class constructor if possible. here i explain you how to…
Q: a new class SafeMember that would allow us to export a reference to a Member. The classes outside…
A: Suggest a simple scheme for creating a new class SafeMember that would allow us to export a…
Q: 1. Explain the importance of method signature in method overriding. 2. The system might want to use…
A: 1) The method signature is basically a declaration of the instance function in the base class so…
Q: 1. Based on the below UML diagram, write the implementation code to represent each class? 2. in the…
A: Given:- Code this in c sharp
Q: Question 4 (students need to interpret code and only write justifications) Solid principle (Liskov)…
A: Here, we describe principle which would be violated if the design is left as is and why?An
Q: How many parameters must be passed if only the following prototype is given to a constructor?…
A: Some Languages supports Optional Parameters and some doesn't supports optional Parameters For…
Q: Which of the following design concepts is unlikely used to justify the need for a refactoring that…
A: Which of the following design concepts is unlikely used to justify the need for a refactoring that…
Q: Question 4 Match the correct answer to the question. Method The information passed to a method in…
A: The information passed to a method in its parenthesis is referred as - Arguments A self contained…
Q: Look at the code below. You have four classes (O, X, T, and M) and a variable of each of these.O o;X…
A: To understand the relationships of these classes we need to know about inheritance. Inheritance…
Q: Consider the following diagram that details the classes Circle and Cylinder. The second row for each…
A: Programming approach:- // using header file. // for precision, formatted double output. // using…
Q: ). Develop a class named Department with two data members: name and size. The name can take values…
A: public class Department { private String name; private int size; public String getName()…
Q: Given below is a Rectangle class consisting of an upper left coordinate and a lower right…
A: public class Point { int xCoordinate; int yCoordinate; }
Q: What is Inheritance? Why is it useful in programming? Write a program which has a class Shape with…
A: Inheritance: Inheritance is a feature of Object-Oriented Programming. A new class is derived from…
Q: Convert the UML class diagram above into a java code with the following conditions The methods in…
A: Actually, UML stands for Unified Modeling Language.
Q: 1) Given the following completed class header: first, find all the errors, then state why the error…
A: All the errors listed in the C++ code are given below with full explanation.
Q: 1. If following is the sequence of the lines of code, where A is the class, which types of…
A: Constructor is the same name as class name and members function of that class. The constructors are…
Q: ????????: Implement the design of the ECustomer class so that the following output is produced:…
A: class ECustomer: count = 0 def __init__(self, name): self.name = name…
Q: Analyze the code below and answer the questions that follows. class Shapes { public void identify ()…
A: OOP stands for Object Oriented Programming.
Q: Which statement of the following is the most appropriate? Group of answer choices When you design a…
A: An invariant in OOP refers to some set of conditions that holds for all instances of a class,…
Q: Consider the following diagram that details the classes Circle and Cylinder. The second row for each…
A: import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner…
Q: Match the correct answer to the question.…
A: Answer: D(Argument) C(Method) A(Inheritence) B(JIT compiler) E(Digit)
Q: a. Write the definition of the default constructor of YClass so that the instance variables of…
A: Describe Constructors and techniques A) The default constructor of YClass is defined as follow:…
Q: classes CriticalException and NonCriticalException. Question 2: Write the source code of classes…
A:
Q: a.) Write the definition of the default constructor of YClass so that the instance variables of…
A: constructors are special function/method which are used to initialize values to instance variables…
Q: Consider the following diagram that details the classes Circle and Cylinder. The second row for each…
A: CPP code : // header files we require #include <string> #include <iostream> // for…
Q: Develop a java program using object cloning. Define a class Placement with variables…
A: The clone() method eliminates the need for additional processing when making an exact replica of an…
Q: This is for a class called Software Test Automation & QA: *For each of the techniques you…
A: The answer is given in the below step
Q: Below is the question, I need answer of Part f, please What is the role of a normal constructor?…
A: PROGRAM CODE: import java.util.*;public class Main {int roll_no,n;int marks[]=new int[50];String…
Q: Use the class diagram below to create a Parking Charge class for an object-oriented parking system.…
A: Given, We have given the ParkingCharge Details: class ParkingCharge{ public String permitID;…
Q: Design a class called Pokemon using a parameterized constructor so that after executing the…
A: Here, Code instruction is given.
Q: Programming Exercises Consider the following diagram that details the classes Circle and Cylinder.…
A: Programming it in C++ as no specific language is stated Including the adequate header files, plus…
Q: 1. Suppose making a class called Day. Two of its variables are year and currentTemperature. The…
A: When a variable is declared final, its value can’t be modified i.e. its value becomes constant. A…
Trending now
This is a popular solution!
Step by step
Solved in 4 steps
- Please use Python for this problem: Please make sure your code is in the correct format and please post a screenshot of the code from Python. When you are finished, test your solutions using a doctest: Develop a class Volume that stores the volume for a stereo that has a value between 0 and 11. Usage of the class is listed below the problem descriptions. Throughout the class you must guarantee that: The numeric value of the Volume is set to a number between 0 and 11. Any attempt to set the value to greater than 11 will set it to 11 instead, any attempt to set a negative value will instead set it to 0. This applies to the following methods below: __init__, set, up, down You must write the following methods: __init__ - constructor. Construct a Volume that is set to a given numeric value, or, if no number given, defaults the value to 0. (Subject to 0 <= vol <=11 constraint above.) __repr__ - converts Volume to a str for display, see runs below. set – sets the volume to…What is the role of a normal constructor? Create the class Student, which must have a normal constructor and at least 5 attributes. Note: The attributes must include all the details mentioned in the scenario and others of your choice. The marks of the student in different modules must be stored using arrays. b. Explain the benefits of encapsulation in Object Oriented Programming. Include proper methods for setting and getting the attributes of the class Student. c. In the class Student, create a method for each of the following results using the array concept and any type of loop: i. The total or average mark of the student in each module. ii. Finding the list of modules that the student has passed or failed in that semester. iii. Finding the highest or lowest mark of the student in all assessments. d. Draw the tracing table that shows an example of execution of any of the previous methods. e. Create details and at all the results found in task 2.c by calling the respective…Carefully understand the code given bellow. Analyze the code and suggest any corrections needed with reason.There may be syntax and logical errors. Class Student { int age; char cnic; int semester; char name; private: int setall(int a, int c, int s, int sem, char n) const ; { age=a; c=cnic; semester=s; name=n; } void Student(int age, char cnic, int semestser, char name) { age =age; cnic=cnic; semester=semester; name =name; } }//; public: int student : displayall ( ) const ; { cout<<Age<<endl; cout<<Name<<endl; cout<<Semester<<endl; cout<<Cnic<<endl; } int main( ) { student 3obj(3,4,5,2); obj 3:: setall( ); obj3 : displayall(int s, char c, char n, int s ); 3obj . setage( ); student obj2; student::obj2.setall(int c, char a, char p, int c ); return 0; }
- What is the role of a normal constructor? Create the class Student, which must have a normal constructor and at least 5 attributes. Note: The attributes must include all the details mentioned in the scenario and others of your choice. The marks of the student in different modules must be stored using arrays. b. Explain the benefits of encapsulation in Object Oriented Programming. Include proper methods for setting and getting the attributes of the class Student. c. In the class Student, create a method for each of the following results using the array concept and any type of loop: i. The total or average mark of the student in each module. ii. Finding the list of modules that the student has passed or failed in that semester. iii. Finding the highest or lowest mark of the student in all assessments. d. Draw the tracing table that shows an example of execution of any of the previous methods. e. Create details and at all the results found in task 2.c by calling the respective…What is the role of a normal constructor? Create the class Student, which must have a normal constructor and at least 5 attributes. Note: The attributes must include all the details mentioned in the scenario and others of your choice. The marks of the student in different modules must be stored using arrays. b. Explain the benefits of encapsulation in Object Oriented Programming. Include proper methods for setting and getting the attributes of the class Student. c. In the class Student, create a method for each of the following results using the array concept and any type of loop: i. The total or average mark of the student in each module. ii. Finding the list of modules that the student has passed or failed in that semester. iii. Finding the highest or lowest mark of the student in all assessments. d. Draw the tracing table that shows an example of execution of any of the previous methods. e. Create details and at all the results found in task 2.c by calling the respective…Language: C++ Create a class named City. Assume that a city has a name, a number of inhabitants, a mayor and an area (in km²). Then create three instances of this class: Bremen, Paris and London. Provide suitable setter and getter methods for each of these properties. The class declaration has to be placed into City.h, the class definition has to be placed into City.cpp and the test program where the instances are created has to be in testcity.cpp. You can set the needed data from the main () function by initialization or read it from the key- board.
- What is the role of a normal constructor? Create the class Student, which must have a normal constructor and at least 5 attributes. Note: The attributes must include all the details mentioned in the scenario and others of your choice. The marks of the student in different modules must be stored using arrays. b. Explain the benefits of encapsulation in Object Oriented Programming. Include proper methods for setting and getting the attributes of the class Student. c. In the class Student, create a method for each of the following results using the array concept and any type of loop: i. The total or average mark of the student in each module. ii. Finding the list of modules that the student has passed or failed in that semester. iii. Finding the highest or lowest mark of the student in all assessments. d. Draw the tracing table that shows an example of execution of any of the previous methods. e. Create details and at all the results found in task 2.c by calling the respective methods. a…Select the answer that best describes the following statements: 1. When a reference type has yet to be instantiated, it contains a null value. II. Association is a specific type of Composition. O Only statement I is true Only statement II is true Both statements I and II are true Both statements I and II are falseWrite a c++ program and explain with comments Create a class called Employee that includes attributes: empid, name, points, group, and avg with data types: “int”, “String”, “double”, “String”, and “double” respectively. Include a constructor with parameters: empid and name. Include another constructor to assign default values to the attributes. Include a function called addPoints that is used to add a given amount to the value of the attribute points. Include a function called upgradePoints that is used to increase the value of theattribute points by a given percentage. Include a function called removePoints that is used to reduce a given amount fromthe value of the attribute points. If the resultant value is negative then the value of the attribute should be set into zero. Include a function called computeGroup that assigns a value to the attribute groupbased on the value of the attribute points as given in the following table. Points Group points < 100 Silver 100…
- 248. The ability for programmers to use the same written and debugged existing class. a. Reusability b. Design c. Debugging d. ImplementationDesign and implement a class dayType that implements the day of the week in a program. The classdayType should store the day, such as Sun for Sunday. The program should be able to perform thefollowing operations on an object of type dayType:a) Set the day.b) Print the day.c) Return the day.d) Return the next day.e) Return the previous day.f) Calculate and return the day by adding certain days to the current day. For example, if the current day is Monday and we add 4 days, the day to be returned is Friday. Similarly, if today is Tuesday and we add 13 days, the day to be returned is Monday.g) Add the appropriate constructors.The class dateType was designed to implement the date in a program, but the member function setDateand the constructor do not check whether the date is valid before storing the date in the member variables.Rewrite the definitions of the function setDate and the constructor so that the values for the month, day,and year are checked before storing the date into the…shows the complete anagram.cpp program. Use a class to represent the word to be anagrammed. Member functions of the class allow the word to be displayed, anagrammed, and rotated. The main() routine gets a word from the user, creates a word object with this word as an argument to the constructor, and calls the anagram() member function to anagram the word.