in the following program what will be the final results of the variable: x and count? class testl{ private: int count, x=0; public: testl(): count(0) { } testl (int c): count(c) {x+=3;} testl operator + (int) {x++; return test1(count++); } }; int main() {test1 L1; Ll+; return 0;}
Q: please make it run using static System.Console; class GreenvilleRevenue { static void Main()…
A: Given Code:- using static System.Console; class GreenvilleRevenue { static void Main() {…
Q: Consider the following C++ code: static long z = 5 ; int d = 10 ; int *ptr1 = new int[2] ;…
A: Given: Consider the following C++ code: static long z = 5 ; int d = 10 ; int *ptr1 = new int[2] ;…
Q: imaginary.h #pragma once #include using namespace std; class Imaginary { private: int…
A: Program approach: Including header files. File- main.cpp. Negative of the complex number. Conjugate…
Q: Take the following code: class Song private: string name; string author; string genre; int…
A: Answer: Code: class Song{ //this is class nameprivate: string name; string author;…
Q: Write the main () function that does the following : Declare an array of runner objects and insert…
A: #include <iostream>using namespace std;class Runner{ private: int num; string name;…
Q: Q6: Convert the attached C++ program to JAVA program .
A: public class Bank { //declaring instance variables private double deposit; private double interest;…
Q: Program: File GamePurse.h: class GamePurse { // data int purseAmount; public: // public…
A: Start the main function.Create an instance of the GamePurse class with an initial amount of…
Q: include void fun1(int num, ...); void fun2(int num, ...); int main() { fun1(1, "Apple", "Boys",…
A: Explanation: The code defines two functions, fun1 and fun2, which have variable arguments. In the…
Q: /VotingMachine.java:63: error: class Assignment03 is public, should be declared in a file named…
A: Here this program might run by removing the public access specifier in the class Assignment03.
Q: MindTap: In C#, Write a program named Averages that includes a method named Average that accepts…
A: The answer is given in the below step
Q: public class Number { private int num; public Number(int n) { num = n; } /*…
A: 1. Import the Scanner class for user input.2. Define a `LabProgram` class.3. Inside the `LabProgram`…
Q: Create a class called Employee that includes three data members: a first name (type string), a last…
A: Consider given monthly salary as x The yearly salary can be calculated as y_x = 12*x Now, giving 10%…
Q: In C++ class film { public: void setFilmDirector(string s); //sets the filmTitle to s…
A: In the given code printAllFilmInfo() prints the information about each film object…
Q: /* TestCarSensor.java - program to test the CarSensor class. */ public class TestCarSensor { public…
A: Errors in CarSensor.java: The class had below errors: Data type was missing for data member: error,…
Q: What is the output of the code on the right?
A: Java is an object oriented programming language.
Q: FOR C++, PLASE SEND THE ANSER IN 30 MINUTES. ACCORDING TO CODE BELOW, #include "Vehicle.hh"…
A: Since the Vehicle class is not entirely given, we will make assumptions while writing down the code.…
Q: #include #include #include #include #include #include using namespace std; class A { public:…
A: In this question we have to understand about the code why it is descending and not ascending in…
Q: vlysteryExami Language/Type: Java parameters return The following console program uses parameters…
A: Here we have a function named hamburger(), which takes 3 string parameters, prints them on the…
Q: C# Write the definition for the Triangle class that works for the following main() method. public…
A: Program Approach: Using package System Using namespace Defining a class Defining double variable…
Q: In C++ QUESTION 14 class rectangleType { public: void setLengthWidth(double x, double y);…
A: In order to write and test the function definition of perimeter we also need to write the function…
Q: 11. You may have noticed that the name parameter in SetName was also changed to a cons reference.…
A: Here is the answer.
Q: #include #include void fun1(int num, ...); void fun2(int num, ...); int main() { fun1(1, "Apple",…
A: Include the necessary header files: stdio.h for input/output operations and stdarg.h for handling…
Q: C++ Evaluate the bulleted statements based on the code snippet and describe why or why not it wont…
A: Here have to determine about code working or not.
Q: 26. Assume the declaration of Exercise 24. A. Write the staternents that derive the class dummyClass…
A: Dear Student, For inheritance we use the syntax - Class B extends A Here class B is the derived…
Q: Consider the following code segment and answer questions 14 and 15. class Point { public: Point…
A: A constructor is a unique method or function used in object-oriented programming that is invoked…
Q: For the C++ program show on the next page, answer the questions that follow. The names g, j, x, and…
A: in line 12,13 ,14 variable f and x is in local scope and variable g is in global scope. in point A…
Q: private: int x, у;
A: Corrected Program: #include<iostream.h> #include<conio.h> class Point { private: int…
Q: class Clock { public: Clock() : hourValue_(0), minuteValue_(0), secondValue_(0) {};…
A: The objective of the question is to override the ShowTime() function of the base class 'Clock'…
Q: C++ Programing ATTRIBUTES NOTE: The important method has been given to you. userld:int //generates…
A: A class is the basic unit of object oriented design. An instance of a class is called an object. A…
Q: In C++ implement the relational operators (, >=) in the Circle class in the code below, to order the…
A: Your C++ program is given below as you required with an output.
Q: Consider the following code: class A { public: void printChar() { cout printChar();…
A: The mechanism of developing and implementing an executable computer program to achieve a particular…
Q: when printing Weigh no value shows up code public class HealthProfile { private String _FirstName;…
A: The problem is due to name resolution in the constructor,when we change it this it will work…
Q: Computer Science c++ help comment code please. Complex has multiple parameters to overload i think.…
A: The given class Complex has 2 private attributes real and complex The class has default constructor,…
Q: The following declaration, program, and program segment has errors. Locate as many as you can. class…
A: This program consists of seven errors. The following statements contain errors: The first error…
Q: Take the following code: class Song private: string name; string author; string genre; int…
A: Given code is: //setters are used change the value stored in one of an object's member variables…
Q: 1. In the CheckingAccount class: a. Create one method for depositing. The deposit method should…
A: Step 1 : StartStep 2 : Declare all variablesStep 3 : create deposit, withdraw, display methodsStep 4…
Q: class Player { protected: string name; double weight; double height; public:…
A: Note: since your question contain multiple subparts but we can answer only 3sub-parts at a time…
Q: int x //x coord of the center -int y // y coord of the center -int radius -static int count //…
A: In this question we have to write a C++ code for circle class. main.cpp using object-oriented…
Q: int x //x coord of the center -int y // y coord of the center -int radius -static int count //…
A: Solution: Code // Circle.h #ifndef CIRCLE_H_ #define CIRCLE_H_ #include <string> using…
Q: C++, ACCORDING THE VEHICLE HEADER, FILL THE PART 1 OF THE CODE #ifndef _Vehicle_hh_ #define…
A: Given : #ifndef _Vehicle_hh_ #define _Vehicle_hh_ class Vehicle { private: float speed;…
Q: Program: File GamePurse.h: class GamePurse { // data int purseAmount; public:…
A: Approach for the additional features : Multilevel Inheritance with Polymorphism and Abstract Class:…
Q: 4. Write part of the code that removes the car from the dealer class that is sold.
A: // part 4:- function to remove class from dealer class public void removeCar() { // delete current…
Step by step
Solved in 2 steps
- The following class declaration has errors. Locate as many as you can. class Box {private:double width;double length;double height; public:Box(double w, l, h){ width = w; length = l; height = h; } // Overloaded prefix ++ operator void operator++(){ ++width; ++length; } // Overloaded postfix ++ operator void operator++(){width++; length++; }... Other member functions follow ...};C++ Help me fix my code please! I'm missing something and can't figure it out. Code and error picture are below. #include <iostream> using namespace std; class Employee{ public: string first_name; string last_name; int monthly_sal; int increment; Employee() { first_name=""; last_name=""; monthly_sal=0; increment=0; } void setFirst_Name(string first_name) { this->first_name=first_name; } void setLast_Name(string last_name) { this->last_name=last_name; } void setSal(int monthly_sal) { if(monthly_sal<0) this->monthly_sal=0; this->monthly_sal=monthly_sal; } void setInc(int increment) { monthly_sal += increment; } string getFirst_Name() { return first_name; } string getLast_Name() { return last_name; } int get_salary() { return monthly_sal; } int get_increment() { return increment;…2- Consider the following program:public class Product{ private int price;public void setPrice(int theprice){price = thePrice;}}public class SpecialProduct extends Item{ private int discount;public void setDiscount(int theDiscount){discount = theDiscount;}}public class Main{public static void main(String[]args){SpecialProduct product = new SpecialProduct();}}Which of the following compiles without a problem? Why?a. product.discount = 20;b. product.setDiscount(20);c. product.setPrice(50);
- Question 8: Questions 8 - 12 are based on the following code. Now, this code results in a compile error (where it's marked "here"). Why? class Fraction {private: int numerator; int denominator;public: Fraction(int n, int d) { numerator = n; denominator = d; } void display() { cout << numerator << "/" << denominator << endl; }};int main() { Fraction f; // <-- here return 0;} Group of answer choices There is no constructor defined Copy constructor is undefined Default constructor is undefined Constructor is defined as public Question 9: Find an incorrect definition of getter/setter for Fraction. Group of answer choices void setNumerator(int n) { numerator = n; } void getNumerator() { return numerator; } void setDenominator(int d) { denominator = d; } int getDenominator() { return denominator; } Question 10: What would be the printout of the following code segment? Fraction f(2, 3); f.display(); Group of answer choices…Write program in C++ Language The other solutions on chegg were incorrect! Please read carefully! Write a program that defines and tests a class called COP3014. The class resembles aclassroom. It has the following grading scheme:3 quizzes 20 points each 20%Mid term 100 points 30%Final 100 points 50%Based on the total grade of any student for the course, the letter grade of each student can becomputed as follows:Any grade of 90 or more is an A, any grade of 80 or more (but less than 90) is a B, any grade of70 or more (but less than 80) is a C, any grade of 60 or more (but less than 70) is a D, and anygrade below 60 is an F.This class needs to have some member variables. The first name, last name, the Z-number, thegrades, the total grade and final letter grade are all considered to be private member variablesof this class.The class should also have the following public member functions/procedural attributes that canbring the objects (students of the class) to life and give them some…#include <iostream> using namespace std; class A { private: int x; public: A(int _x) { x = _x; } int get() { return x; } }; class B { static A a; public: static int get() { return a.get(); } }; int main(void) { B b; cout << b.get(); return 0; } Excecute and provide the screenshot.
- To write an application that uses recursion to solve a problem. Details: Create a class called Power that computes the value of base exponent. The class should have one recursive method: • public static int power(int base, int exponent) – Which computes the value of base exponent using recursion, returning the result. The recursion step should use the following relationship base exponent = base x base exponent - 1 and the termination condition should occur when exponent is equal to 1, because base 1 = base NOTE: For the power method, assume the exponent parameter value is always greater than 0. Create a second class called PowerTest that contains the main method, and tests the Power.power method. The test class does not need to ask for input from the user of the class, nor does it need to do any additional error checking. Upload both source files to Blackboard. Note: Ensure that your program is properly formatted and it follows all Java naming conventions.// This class discounts prices by 10% public class DebugFour4 { public static void main(String args[]) { final double DISCOUNT_RATE = 0.90; int price = 100; double price2 = 100.00; tenPercentOff(price DISCOUNT_RATE); tenPercentOff(price2 DISCOUNT_RATE); } public static void tenPercentOff(int p, final double DISCOUNT_RATE) { double newPrice = p * DISCOUNT_RATE; System.out.println("Ten percent off " + p); System.out.println(" New price is " + newPrice); } public static void tenPercentOff(double p, final double DISCOUNT_RATE) { double newPrice = p * DISCOUNT_RATE; System.out.println"Ten percent off " + p); System.out.println(" New price is " + newprice); } }C# Write a program named TestScoreList that accepts eight int values representing student test scores. Display each of the values along with a message that indicates how far it is from the average. An example of how the results should be output is as follows: Test # 0: 89 From average: 6Test # 1: 78 From average: -5 using System;using static System.Console;class TestScoreList{static void Main(){// Write your main here}}
- C++ printSmaller is a function that accepts two int parameters and returns no value. It will print the value of the smaller one parameters. The function protoype is as follows: void printSmaller(int num1, int num2); write the statments to read two integers and call this function to display the smaller one.class Course { private String courseNumber; private String courseName; private int creditHrs; public Course (String number, String name, int creditHrs){ this.courseNumber = number; this.courseName = name; this.creditHrs = creditHrs; } public String getNumber() { return courseNumber; } public String getName() { return courseName; } public int getCreditHrs() { return creditHrs; } public void setCourseNumber(String courseNumber) { this.courseNumber = courseNumber; } public void setCourseName(String courseName) { this.courseName = courseName; } public void setCreditHrs(int creditHrs) { this.creditHrs = creditHrs; }}class Student { private String firstName; private String lastName; private String gender; private String phoneNumber; private String email; private String jNumber; protected ArrayList courseList; public String getFullName() {…this is my retail item code: //Import statements public class RetailItem { private String description; private int units; private double price; public RetailItem() { } public RetailItem(String x, int y, double z) { description = x; units = y; price = z; } public RetailItem(RetailItem i) { } public void setDescription(String x) { description = x; } public void setPrice(double z) { price = z; } void setUnits(int y) { units = y; } public int getUnits() { return units; } public String getDescription() { return description; } public double getPrice() { return price; } // Main class public static void main(String[] args) { String str = "Shirt"; RetailItem r1 = new RetailItem("Jacket", 12,…