C++ Answers

Questions answered by Experts: 9 913

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

FAST-NUCES has expanded its operations to a great extent and it needs an automated

helpline system for its One Stop Student Center. In order to develop the system, FAST-NUCES has hired

the best programmers from its Islamabad campus. You are required to develop the following scenario for

the helpline system using switch-case construct in C++.

FAST-NUCES has five campuses at Islamabad, Lahore, Karachi, Peshawar, and Faisalabad in Pakistan.



A decision tree is a decision support tool that uses a tree-like model of decisions and their

possible consequences. It is widely used in classification and prediction problems. You are required to

implement the below decision tree to help you decide whether you should go for a trip or not based on

various factors. You also need to take string inputs from the user in this program.



I'm really fond of even numbers, you know? That's why I'll be letting you make another even number problem yet again. This time, you need to print from a range of two inputted numbers, n1 and n2 (inclusive), all the even numbers from n2 down to n1, in descending order.

write a c++ program to "Find the 3% total salaries of John, Paul and Simon."


Create a program that will calculate your grade in Prelim, Midterm, Prefinals, and Finals. After that, determine if you passed or failed in that subject based on your calculated grade.

 Rewrite the code in C++ using Factory Method. The goal is to remove the

main function’s dependency on the concrete classes, such as WalkToSchool.


#ifndef WALKTOSCHOOL_H

#define WALKTOSCHOOL_H

#include <iostream>

#include "GoToSchool.hpp"


using namespace std;


class WalkToSchool:public GoToSchool {

  void takeTransit() { cout << "We are walking to school." << endl; }

  void arrive() { cout << "After 10 minutes, we arrive." << endl; }

};


#endif


 Rewrite the code in C++ using Factory Method. The goal is to remove the

main function’s dependency on the concrete classes, such as GoToSchool.


#ifndef GOTOSCHOOL_H

#define GOTOSCHOOL_H

#include <iostream>


using namespace std;


class GoToSchool {

  void getUp() { cout << "Get up." << endl; }

  void eatBreakfest() { cout << "Eat breakfest." << endl; }

  virtual void takeTransit() { cout << "Take school bus." << endl; }

  virtual void arrive() = 0;

 public:

  void go() {

    getUp();

    eatBreakfest();

    takeTransit();

    arrive();

  }

};


#endif


 Rewrite the code in c++ using Factory Method. The goal is to remove the

main function’s dependency on the concrete classes, such as FlyToSchool,

#ifndef FLYTOSCHOOL_H

#define FLYTOSCHOOL_H

#include <iostream>

#include "GoToSchool.hpp"


using namespace std;


class FlyToSchool:public GoToSchool {

  void takeTransit() { cout << "We are taking a flight." << endl; }

  void arrive() { cout << "After 2 hours, we arrive." << endl; }

};


#endif



Write a program to calculate the area of a rectangle by creating a class named 'Area'




with two variables ‘length’ and ‘breadth’ and two functions. First function named as




'setValues' set the length and breadth of the rectangle and the second function named as




'getArea' returns the area of the rectangle.

Write a C++ program that generates a random number from 0 to 10 and saves it in an integer Correct. The program prompts the user to guess the number between 0 and 10. If the user guesses the number that matches Correct, then the program outputs the message “you guessed the number correctly”. Otherwise, the program checks whether the guessed number is less than Correct and outputs the message” your number is lower than the number. Guess again”. If not, the program will output “your number is higher than the number. Guess again”. The program prompts the user to enter another number until the user enters the correct number.


LATEST TUTORIALS
APPROVED BY CLIENTS