(b) specify the location of the errors. If you find no error at all, write "No Errors." Find all 5 syntax mistakes in the following code. Use the line number to 1 #include 2 4 class X { 5 public; X (double x): x(x) bool to_bool() {return bool (x);} void display () {std::cout << x;} int add_one () {return ++x;} 6. 7 10 11 private: double x; 12 13 } 14 15 int main() 16 { X x = 2.5; if (to_bool(x)>0) 17 18 std::cout << x.display (); else x. add_one(); 19 20 21 return 0; 22 }
Q: What is the output of the following code? # include # include using namespace std; struct Test
A: In Test() method inside the struct declaration, we are initializing str to MidQuiz
Q: B) What is the value of speed when the following code snippet runs successfully? const int…
A: 1) Code snippet in Question B does below activities It defines MIN_SPEED 45 and MAX_SPEED as 65…
Q: please do its main part. #include using namespace std; int calc( int x, int &three, int &five ) {…
A: Program with its main part is as follows, #include <iostream> using namespace std; int calc(…
Q: 2. Electric Bill: Write a program that will calculate and show bills of the Manila Electric Company.…
A: The code is given below.
Q: 2. For Questions 2 (a-c), refer to the declarations and initializations below. Indicate whether each…
A: Answer: As the given code snippet is in C language. In the given code snippet a double array is…
Q: What is the output of the following code segment? double vall = -7; int val2 = 9;…
A: If we break the calculation into segments. Floor value will return the lower bound of the integer.…
Q: Question 9 What are the values of x, y, and z after the following code executes? int x = 0; int y =…
A: Answer:
Q: 19 With the following declaration: int [,] points = {{300, 100, 200, 400, 600}, {550, 700, 900, 200,…
A: Required:
Q: What would be the correct answer for the following code? Explain. #include int main(void) } int x…
A: int x = 24, y = 39, z = 45; z=x+y; z= 24+39 z=63 y=z-y; y=63-39 y=24 x=z-y; x=63-24 x=39 printf…
Q: A- Given the declaration: int main () int x; int p; int q; return 0; mark the following statements…
A: Answer: Valid Invalid Valid Valid Invalid
Q: 1- Choose the statement that does not apply to the following declaration: double [,]…
A: The answer to this question is establishes the maximum number of rows as 4
Q: In your own words explain the difference between a Valid argument and a Sound argument.
A: The question is on: explaining the difference between a Valid argument and a Sound argument.
Q: Complete the class Problem 1, the program does the following: Prompt the user to enter an integer n.
A: Please find the answer below :
Q: What will be the output of the following code: #include using namespace std; class Box { private:…
A: Program: #include <iostream> using namespace std; class Box { private: int length;…
Q: Find the error in the following code and explain: #include int main(void) int n 9, div = 0; div n/%;…
A: GIVEN:
Q: (B)What should be printed on C++ screen? #include void main() { int x = 5; if(x++ == 5)…
A: Explanation: iostream.h is a header file which contains defalut functions like cout ,cin . Here you…
Q: 9 - With the following declaration: int [.] points = {{300, 100, 200, 400, 600}, {550, 700, 900,…
A: Required:
Q: Find the error in the following code and explain how it can be removed? #include int main(void) {…
A: Error in the code : The above code will give a "divide by zero" error because div has been assigned…
Q: 9- The script in the left side is used to solve the right-side equation. * #include #include using…
A: Given: A C++ program is given and an equation is given. Requirement: Choose whether the given code…
Q: A. If you have the following code: int a = 2, b = -3, c 2; %3D bool vall = false, val2 true; char ch…
A: There are many expression given with one code as per mentioned below, int a=2,b=-3,c=2; bool…
Q: When is a typedef statement necessary? a. It's never necessary, it's just a good tool to use O b.…
A: Typedef: The typedef feature of the programming language allows us to establish an alias or new name…
Q: #include stars in the form of void main(){ int i,j; for (i=0;i0;j-{ if(j>5+i| lj<5-i) cout<<" ";…
A: For i =0 and j =10 the if condition becomes true that is 10 >5 hence the print statement will…
Q: They should type them in a line with spaces or commas between (specify which). Drop the lowest two…
A: Python used to answer this question
Q: ne following ray ns are alld If a declaration is valid, write VALID. If it is invalid, you can make…
A: Given : (a)int[50] list;
Q: What would be the output of the following code? #include using namespace std; int main(){ int b =…
A: Switch case: Switch statement is operated based on the expression of the switch. Switch statement…
Q: What will be printed on the console? 1. What will be printed on the console char c = '0'; if(c >…
A: there is an error in the first line so the first error is: error: expected ‘;’ before ‘)’ token…
Q: 9- The script in the left side is used to solve the right-side equation. #include #include using…
A:
Q: QUESTION 10 What is wrong with the following code? #include using namespace std; void displayString…
A: Question 10: There is no parameters passed inside the display string. So the program gives a error.
Q: c++ This program prompts the user to enter three distinct int type values and display the maximum,…
A: Code and screenshot is attached, tested with many test case and working fine. (note that Median…
Q: Evaluate the following expressions, assume the following declarations: int a=28; int b=4; int c=2;…
A: The given expression is as below- int a=28; int b=4; int c=2; int z=0; z*=a/b-c;
Q: DETERMINE THE OUTPUT OF THE CODE : #include using namespace std; int main() { int i,prod=1; i=1;…
A: Coded using C++.
Q: Optional parameters are represented with the following character: a. > b. = c. * d. ! e. ?
A: Optional parameters must be specified some value at the end of parameter otherwise it will throw…
Q: Will the following code display the larger of the two values? Answer the question and explain your…
A: Given program: #include <iostream>using namespace std; void find_larger(int v1,int v2, int…
Q: 5- What should be printed on C++ screen? #include void main() { int x = 5; if(x++ == 5)…
A: Option : E) None of the above Explanation : fatal error: iostream.h: No such file or directory 2…
Q: Evaluate the following expressions, assume the following declaration: int x = 4; What is displayed…
A: The programming languages C, C++, Java supports increment(++) and decrement(--) operators. These…
Q: QI: tinclude (a) Write two different techniques to declare and initialize a variable with an…
A: Hey, since there are multiple questions posted, we will answer first question. If you want any…
Q: i cant use static void Main(string[] args) for this assignment for C# this is what I have to work…
A: required: Write a program named GuessingGame that generates a random number between 1 and 10.…
Q: What is wrong with the following code? #include using namespace std; void displayString (string);…
A: Function displyString(string) has return type of Void and it takes a String parameter. But when…
Q: Find the output #include void main () { int a=3,b32,c%3a*b; b++; a=b++; b++;…
A: #include <iostream> using namespace std; int main(){ int a=3, b=2, c=a*b; b++; a=b++;…
Q: Help in Java please - I am receiving invalid statement codes for this application Write an…
A: public class TriangleYN{public static void checkTriangle(double a,double b,double c)//our static…
Q: What would be the output of the following code? #include using namespace std;
A: Here the initial value of X is 30.
Q: using namespace int main() { int x = 2; {
A: Introduction: Below the output of the c++ program with screenshot
Q: int this as soon as Code design.
A: I have written HTML Code below:
Q: Examine the following code segment. What will be printed? If there are any errors indicate the…
A: Identify the errors in the program: (i) Syntax error: Variable "i" is not declared. (ii)Syntax…
Q: ?What is the output of the following code #include using namespace std; int fun(int a, int b = 1,…
A: Default parameter value can be assigned using the equals sign If we call the function without an…
Q: 3. Following is an example of different ways one can declare variables for some programming…
A: following are the possible Regular expressions :
Q: 1) int main() first 4): f.show): return 0
A: For given c program template, first fix the class declaration. above the main code, so that they can…
Q: (B)What should be printed on C++ screen? #include void mainO { int x = 5; if(x++ == 5)…
A: Given:
Q: (a) int *ptrl=&a, a; int *ptrl, a; (b) ptrl=&a; (c) int *ptrl; int a; ptrl=&a; (d) int *ptr2, a,…
A: “Since you have asked multiple questions, we will solve the first question for you. If you want any…
The language for the question is C++
Step by step
Solved in 2 steps
- Java Questions - (Has 2 Parts). Based on each code, which answer out of the choices "A, B, C, D, E" is correct. Each question has one correct answer. Thank you. Part 1 - 9. In Java, composition is said to use __ relationship. A. is-aB. part-ofC. has-aD. both is-a and part-ofE. both has-a and part-of Part 2 - 10. Given the following code, which statement is true? class Water() { ... }class Juice() extends Water { ... }class Apple() { ... }class ApplePie() { Apple a1 = new Apple(); }class AppleJuice() { Apple a1 = new Apple(); Water w1 = newWater(); } A. Juice is a superclass and Water is a subclass.B. ApplePie is a superclass of Apple.C. ApplePie is a composite class that contains an instance of Apple class.D. AppleJuice is a superclass that contains an instance of Apple class and an instance of Water.E. Water is a composite class that contains an instance of Juice.PLEASE TRACE BY HAND OR SHOW WHAT EACH VALUE IS ASSIGNED TO and SHOW the OUTPUT for the following code: THE USER INPUT IS: 87 45 for the CODE THAT FOLLOWS: #include<iostream> using namespace std; class twoNums { public: void setOne (int); // sets the private member one to the value of the parameter void setTwo (int); // sets the private member two to the value of the parameter void nicePrint(); // prints the values of the both private members, one first followed by two, // with 2 blank-spaces between then moves to a new line private: int one; int two; }; int main( ) { cout << "==========\n"; twoNums *ptr; int numONE, numTWO; ptr = new twoNums; ptr->setOne(numTWO); ptr->setTwo(numONE); ptr->nicePrint();…A(n) _____ is the name of a Java class, method, or variable. identifier constructor mutator accessor
- Java Questions - (Has 2 Parts). Based on each code, which answer out of the choices "A,B,C,D,E" is correct. Each question has one correct answer. Thank you. Part 1 - 3. Given the following code, the output is __. class Base { private int x = 5; }class Derived extends Base { x = 6; }public class Sample { public static void main(String[] args) { int x = 7; Derived d1 = new Derived(); System.out.print(d1.x); }} A. 0B. 5C. 6D. 7E. Error message Part 2 - 4. A class Animal has a subclass Mammal. Which of the following is true? A. class Animal extends Mammal { }B. class Mammal extends Animal { }C. class Animal implements Mammal { }D. class Mammal implements Animal { }E. class Mammal { Animal a1 = new Animal(); }Java Questions - (Has 2 Parts). Based on each code, which answer out of the choices "A,B,C,D,E" is correct. Each question has one correct answer. Thank you. Part 1 - 5. Given the following code, the date is set to be __. Calendar cal = Calendar.getInstance();cal.set(2059, 0, 1, 2, 2, 1); A. Feb 1, 2059B. Mar 2, 2059C. Jan 1, 2059D. Feb 2, 2059E. Jan 2, 2059 Part 2 - 6. Given the following code, what is the output if the current time is 14:55:32? Calendar cal = Calendar.getInstance();System.out.println(get(Calendar.AM_PM)); A. AMB. PMC. 0D. 1E. Calendar.AMWrite 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…
- !!!FIRST READ EVERYTHING WRITTEN BELOW AND IF YOU CAN DO IT ONLY THEN START AND NO PLAGIARISM!!! Only use C++ to do this task. And I will only give thumbs up if you do not plagiarize from another Chegg or internet source. Also only if you will follow all the below instructions 100%. Only write typed answer. No handwritten. Code must visibly shows the functions and class. Attach the screenshot of output and code must be 100% complete and correct. Write a Twitter class that sets the Twitter user first (who is to be followed) and lets the client add up to 5 followers, which will be stored in an array with a capacity of 5. These users/followers could be in the form of string or Profile but both must be of same type. (Note that the followers are not stored as users, but as strings or Profiles). At any time, your main program should be able to remove any user, x from following another user, y (i.e., x is no longer in the array of followers of y). You are free to design your program as you…Hello! I am working my way through this problem for my Introduction to Java Programming Course. I think I understand the majority of it but I am have a very hard time understanding and developing the bounding box methods. I have developed the Point, Shape, Rectangle, Triangle and Circle classes but I am lost on how to calculate the bounding box coordinates for each of the hierarchy shapes. If someone would be kind enough to walk me through and explain this program, I would greatly appreciate it. Thank you kindly! Problem #5: Create a Point class to hold x and y values for a point. Create methods show(), add() and subtract() to display the Point x and y values, and add and subtract point coordinates. Hint: Keep x and y separate in the calculation. Create another class Shape, which will form the basis of a set of shapes. The Shape class will contain default functions to calculate area and circumference of the shape, and provide the coordinates (Points) of a rectangle that encloses the…code in java Download the file boxer.java write the code for determining the boxer’s weight class as described in the comments. Compile your code and remove any errors, submit the file named boxer jav Please use the most SIMPLEST and BASIC method i am attaching an image of the code that i used earlier which got rejected and i am putting the statement of the professor here(correct it accordingly)- not sure you understood how the else keyword works. when u r using the else-if structure for this, you do not need the complex conditions, because you can ONLY get to the code following the else keyword if the previous if condition FAILED, so you do not need to test that condition again.
- Create a class “Student” with data members such as roll number, name and branch. Create another class “Exam” for storing marks of three subjects. Derive a new class “Result” from “Student” and “Exam” class with data members such as total and average. Display the values of all the data members. Develop a C++ program to model the above relationships. Include comments for the code. Also, can you include screenshots of the code and the output as well Test cases Private – Input 1000 ABC CSE 90 80 70 Output 240 80 Public – Input 2000 DEF IT 25 30 35 Output 90 30ANSWER IN JAVA STANDARD OUTPUT: Enter·length·of·rectangle:Enter·width·of·rectangle:Area:·22.5,·Perimeter:·21.0↵ Create a class Rectangle with double attributes length and width. The default constructor should set these attributes to 1. Provide methods that calculate the rectangle's perimeter and area, as well as accessors and mutators for both data fields. The mutator methods for length and width should verify that the number being passed in is larger than 0.0 and less than 20.0 -- if it doesn't fit those criteria, the value of the field should not be changed.Write a Driver class in the same file to test your Rectangle class. It should prompt the user to enter a length and width of a rectangle, and then print out the area and perimeter of the rectangle. (Use the mutators to set the length and width of the rectangle, not the constructor.)Write a Rational class. Recall a rational number is a rational number, composed of two integers with division indicated. The division is not carried out, it is only indicated, as in 1/2, 2/3, 15/32. You should represent rational numbers using two int values, numerator and denominator. #include <iostream> #include <string> #include <stdlib.h> using namespace std; class rational { public: /* default constructor set the rational number to 0, (i.e., numerator is 0, denominator is 1) */ rational(); /* Set the invoking object's value from user input */ void input(); /* Display invoking object's value in the standard output, in the form of numerator/denominator */ void output() const; //return the invoking object's numerator int get_numerator() const; //return the invoking object's denominator int get_denominator() const; // Set invoking object to be the sum of op1 and op2 void Add(const rational& op1, const rational& op2); // Set the invoking…