Question

There are four syntax errors/incorrect statements in the following class definition. List the line numbers of...

There are four syntax errors/incorrect statements in the following class definition. List the line numbers of the lines that contain errors, and then write the corrected line(s). (4 points) class jetType //Line 1 { //Line 2 public: //Line 3 void setValues(string, int, double); //Line 4 print() const; //Line 5 string getManufacturer() const; //Line 6 double getPrice() const; //Line 7 bool compareSeating(const jetType&); //Line 8 int jetType(); //Line 9 jetType(string); //Line 10 jetType(string, int, double); //Line 11 private; //Line 12 string manufacturer; //Line 13 int numberOfSeats; //Line 14 double price; //Line 15 } //Line 15 jetType myJet(); //Line 16

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Line 4 // return type missing for print () function

Line8 // constructor should not have return value.

Line 11// private must be followed by colon":" but here is semicolon";"

Line 15// class declartion must end with semicolon.}; Missing semicolon

Add a comment
Know the answer?
Add Answer to:
There are four syntax errors/incorrect statements in the following class definition. List the line numbers of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a program that uses the class productType Please specify what goes in main.cpp, productType.h and...

    Write a program that uses the class productType Please specify what goes in main.cpp, productType.h and productType.cpp Please do not leave anything out, thank you! Consider the definition of the following class: (1, 2,3, 5,7) class productType 8. //Line 1 //Line 2 //Line //Line 4 //Line5 public: productType () productType (int, double, double) productType (string, int, double, double) /Line 6 productType (string, string, string, int, double, double) //Line'7 void set (string, string, string, int, double, double) //Line 8 //Line s...

  • C++ Consider the definition of the following class: (1,2,3, 5,7 clasa productTyp publie productType O productType(int....

    C++ Consider the definition of the following class: (1,2,3, 5,7 clasa productTyp publie productType O productType(int. double, double) productType (atring, int, double, double)s //tine6 productType (atring. atring.atring //Line1 /Line 2 /Line 3 //Line /Line s int, double, double) //Line 7 void set (atring, atring, string. int void print) const double, double) i //Line //tine 9 void setQuantitiesInstock (int x) void updateQuantitiesinstock (int x) int getQuantitiesInstock) const //Line 10 //Line 11 //Line 12 void #etPrice (double x); double getPrice) consti //Line...

  • C++ question The code below has five errors.  The errors may be syntax errors or logic errors,...

    C++ question The code below has five errors.  The errors may be syntax errors or logic errors, and there may be more than one per line; examine the code carefully to find them.  Indicate each of the errors you find by writing the line number and correction in the space provided below. You must find and correct all five of the errors. If there were no errors, this code would output: Paycheck for 123-45-678 : $690.625 Paycheck for 876-54-321 : $818.125 1...

  • The following class contains several errors that violate the rules of Java: class Part ( private...

    The following class contains several errors that violate the rules of Java: class Part ( private int number: private String name: private int quantity: public Part (int number, String name, int quantity) { this.number = number: this.name = name: this quantity = quantity: } public Part (int number, string name) { this (number, name, 0): } public Part () { this (0, 'No name'): } public void decreaseQuantity(int amount) { quantity = -amount: } public int getName () { return...

  • Given the following class definition in the file Classroom.h, which XXX and YYY complete the corresponding.cpp...

    Given the following class definition in the file Classroom.h, which XXX and YYY complete the corresponding.cpp file? #ifndef CLASSROOM_H #define CLASSROOM_H class Classroom public: void SetNumber(int n); void Printo const; private: int num; }; Tendif #include <iostream using namespace std; XXX void Class Room:: Set Number(int n) { nun: cout << "Number of Class Rooms: << num << endl; include "Classroom.hr vold Classroom: Print( const sinclude "Classroom.cpp" vold Classroom. Print() const #include "Classroom.h" void Class Room::Print) const #include "Classroom.cpp" void...

  • Below is a class definition (.h) for the Bookclass. class Book { private:     int numPages;     string...

    Below is a class definition (.h) for the Bookclass. class Book { private:     int numPages;     string author;     string isbn;     double price; public:     string title;      public:     Book ();     void setAuthor(string);     string getAuthor();     void setIsbn(string);     string getIsbn ();     void setPrice(double);     double getPrice ();     string getTitle (); };                Assume you are writing code within the maindriver program: declare variable of type Book. Using the Bookvariable, set your book’s author to Edgar Allan Poe Using the Bookvariable, set your book’s title to The...

  • The files provided in the code editor to the right contain syntax and/or logic errors. In...

    The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. // Start with a penny // double it every day // how much do you have in a 30-day month? public class DebugSix1 { public static void main(String args[]) { final int DAYS = 30; double money = 0.01; int day =...

  • C++ Practice: Answer Whichever you can & it'll help a lot. Thank you! Question 1. Implement...

    C++ Practice: Answer Whichever you can & it'll help a lot. Thank you! Question 1. Implement the constructors and member function of each of the classes (Marks 15) class Fraction{ private: int numerator; int denominator; public: Fraction(int, int); float fractionValue();//determines the value of numerator/denominator }; class Problem{ private: Fraction f[3]; public: Problem(int, int, int, int, int, int); Fraction largestFraction();//Returns the fraction having largest fraction value }; Question 2: In the following Inheritance problem #include<iostream> #include<string> using namespace std; class Animal{...

  • Find the syntax error(s) in the following class and function definition. [You need to identify the...

    Find the syntax error(s) in the following class and function definition. [You need to identify the line number only). 1. class Class1 2.{ 3. private 4. int data; 5. public 6. class1: class 1(); 7. double function 1(); 8.} 9. class: class 10) 10.{ 11. data =5; 12.}

  • The files provided in the code editor to the right contain syntax and/or logic errors. In...

    The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. // DebugFive2.java // Decides if two numbers are evenly divisible import java.util.Scanner; public class DebugFive2 { public static void main(String args[]) { int num; int num2; Scanner input = new Scanner(System.in); System.out.print("Enter a number "); num = input.nextInteger() System.out.print("Enter another number ");...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT