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 & Filtering

 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



Make a mailing list of vendors who provide bikes. Include a Type column that says Vendor. Make sure each distinct vendor only appears once. (5 rows)


Write a C# program to do help manage your credit card debt. The Main method is to repeatedly prompt the user to enter a transaction code (char) which could be ‘B’ or ‘b’ to buy an item using the credit card, ‘c’ or ‘C’ to make a cash withdrawal from the credit card, ‘p’ or ‘P’ to make a payment on the credit card, ‘D’ or ‘d’ to display the balance of the credit card, and ‘q’ or ‘Q’ to quit. the initial balance on card is $0.00.Using a switch statement in the do-while loop on Main, select the appropriate action and call (invoke) the appropriate user-defined method. The Main method should continue accepting

transactions until the user enters a ‘Q’ or ‘q’.(i) A method call ReadAmount which takes no formal parameters but returns a positive value of type double which is the cost of an item, the amount of cash withdrawn, or amount payment.ReadAmount is to be called by Main() when the user chooses to buy an item (B’ or‘b’),withdrawal cash (‘c’ or ‘C’), or make a payment (‘p’ or ‘P’).The ReadAmount should be positive


Create a program that allows bags to be purchased. There are six different types: full decorative, beaded, needlepoint design, fringed beaded and plain. Create a ListBox object for the different styles. After the user makes a selection, display a message indicating which selection was made. Include an option to clear selections. Include a control that allows the user to enter the quantity desired. Include a set of radio buttons that contain shipping options of overnight, three day and standard. The price for each bag is as follows: full decorative R50; beaded – R45; needlepoint design – R40, fringed beaded – R30 and plain – R20. The shipping charges are based on the total purchase. The following percentages are used: Overnight – 10%, three day – 7% and standard – 5%. Display in a message box the shipping charge along with the selection, quantity and total cost.


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.


Write a C++ program that reads a sequence of integer numbers from the input file data.txt. The sequence ends with a sentinel value of zero. The program should output the following into an output file results.txt

  1. the count of all positive numbers.
  2. the count of all negative numbers.
  3. the sum of the positive numbers.
  4. the sum of the negative numbers.
  5. the maximum of negative numbers and
  6. the minimum of positive numbers.

Use the following values in the file data.txt to test your program:

5

4

-8

-7

6

-2

9



Write a C++ program that prompts the user to enter an even integer N which represents how many numbers he/she wants to enter. The program then reads N decimal numbers and finds the minimum number in the first half and the maximum number in the second half.


a. Partially True

b. Absolute True

c. Partially False

d. Obviously False

Choose the appropriate one from the options above.


1. bool arr[ ] ={false, ture, 0}; is a calid array declaration and initialization.


2. float arr[6] = {43, 23.23 ,423 ,123.43 ,876,23}; is a valid array declaration and initialization.


3. int arr[55] = {1, 2, 3, 4123.34, 123.43, 876, 23}; is a valid array declaration and initialization.


4. int arr[2] = {1, 2, 3, 4123.34, 123.43, 876, 23}; is a valid array declaration and initialization.


5. float arr[20] = {43, 23.23 ,423 ,123.43 ,876, 23}; is a valid array declaration and initialization.


6. bool truth_table[ ] ={true}; is a valid array declaration and initialization.


7. int arr[ ] = {1, 2, 3, 4123.34, 123.43, 876, 23}; is a valid array declaration and initialization.


8.what is the output if the user input are the numbers 12, 23, 34, 45, 56, 67, 78, 89, 90, 101?



LATEST TUTORIALS
APPROVED BY CLIENTS