Questions: 11 448

Answers by our Experts: 10 707

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

Write a program that declares two classes. The parent class is called Shape that has two data members num1 and num2 to store two numbers. It also has four members functions.

·        The setarea() function set the area and displays the result.

·        The getarea() function get the area and displays the result.

·        The setdraw() function set the coordinates for draw and displays the result.

·        The getdraw() function get the coordinates for draw and displays the result.

The child class is called Circle that overrides all four functions. Each function in the child class checks the value of data members. It calls the corresponding member function in the parent class if the values are greater than 0. Otherwise it displays error message. All the possible exception is handle through exception handling.



Develop a university payroll application. There are two kinds of internee in the university salaried internee, hourly internee. The system takes as input an array containing internee objects, calculates no.of days spent in the university polymorphically, and generates results.

 

give me an example of gotoxy for loop program in c++


a program that will determine the area of the following: circle, square, rectangle and triangle.


Sample Program Run

Enter the number of test cases: 1

Enter the size of the array: 5

Enter the number of rotation to perform: 2

Enter the elements of the array: 1 2 3 4 5

Resulting array: 4 5 1 2 3


Sample Program Run:

Enter number of test cases: 3


Enter the size of the array: 5

Enter the elements of the array: 5 1 4 2 3

Number of Inversions: 6


Enter the size of the array: 10

Enter the elements of the array: 2 1 3 4 5 6 7 9 8 10

Number of Inversions: 2


Enter the size of the array: 7

Enter the elements of the array: 4 1 3 5 2 3 8

Number of Inversions: 7


Create a Program

You will create a program that displays amount of a cable bill. The Amount is based on the type of customer, as shown in the figure. For a residential customer, the user will need to enter the number of premium channels only. For a business customer, the user will need to enter the number of connections and the number of premium channels. Also enter appropraite comments and any additional instructions in your c++ program. Test the program appropriately before submission. 


You are living off-campus and drive your car to ODU campus everyday of a week. You wonder how many mileages you travel in a week (just to campus and back home) and how much you need to pay for the gas. You log your travel mileage every day during a week (just to campus and back home). This information has been saved in an input file called “mileage.txt”.

Design an algorithm and write a C++ program to do the following:

  • Output the mileage for each day.
  • Prompt user to enter the price for one-gallon gas.
  • Calculate and output the total cost of your travel in the week. Your car's Miles per Gallon (MPG) is 35.
  • Save the output in a file named “cost.txt”.

Develop a C++ Menu Driven application to keep track of all following data items, Make sure that your Menu incorporates all functionalities of the app:

Student with the following attributes:

● Student_Id, student full name, average mark and course_id.

Course with the following attributes:

● Course_id, Course designation, number of years to complete and fee.

School with the following attributes:

● School code and highest qualification offered.

Award with the following attributes

● Award code, description and amount.


● Four functions each responsible for capturing data about one of the data items above. Each stored in their respective array.

● A function that searches for a maximum mark of a certain student; identified by their student id.

● A function that checks if award is offered. searched by both their code and description.

● A function that allows replacement of the highest qualification offered by a school.

● Overload a function called DisplayDetails that displays all records for all the four data items.


1. Trace and comment each and every line of the C++ program below:

#include <iostream>

using namespace std;

int binarySearch(int arr[], int left, int right, int num)

{

if (right >= left) {

int mid = left + (right - left) / 2;

if (arr[mid] == num)

return mid;

if (arr[mid] > num)

return binarySearch(arr, left, mid - 1, num);

return binarySearch(arr, mid + 1, right, num);

}

return -1;

}

int main(void)

{

int arr[] = { 2, 3, 4, 8, 10, 40 };

int check = 40;

int n = sizeof(arr) / sizeof(arr[0]);

int result = binarySearch(arr, 0, n - 1, check);

(result == -1)

? cout << "Element is not present in array"

: cout << "Element is present at index " << result;

return 0;

}


LATEST TUTORIALS
APPROVED BY CLIENTS