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

Create a class named Laboratory containing • Two data fields i.e. name (a string) and location (string)

• A no-argument constructor to initialize all data fields with default values “NoName” and “NULL”

• A member function named input()

• A member function named show() to display the details associated with an instance of this class Lab 9 - Function Overloading and Function Overriding Capital University of Science and Technology, Islamabad Department of Computer Science (2020) Page 106 Derive a class named WetLab from class Laboratory that includes

• data members no_of_microscopes and Scientist_name,

• respective mutator and accessor functions • overriding function named input() to take input from user in all data members

• overriding function named show() to display the details associated with an instance of class WetLab From the Laboratory class, derive a class named DryLab that contain

• a data field named no_of_computers and Capacity • Setters and getters



Consider a class Fruit that contains o A data member named as Fruit Name of string type o A data member named as Quantity of type int o A data member named price-per-kg of type double o A member function displayprice(Fruit) that shows the price of the instrument while evaluating the name of the instrument object that it accepts as a reference parameter Derive two classes named Mango and Watermelon from the class Fruit that contain o A parameterized constructor to initialize data members that they inherit from the class Fruit


Suppose you are playing a killing game and have to kill few of your enemies. You are at a cliff and from there you can see few of them. You see the enemies at your height only. Therefore, you can only kill at the same height. The enemies are forming a balanced binary tree where their General is at the top of the other cliff, his two commanders are on the first level below him. The soldiers are at the lowest level. Total four soldiers are appointed. Under both the commanders exact two soldiers serve.

You have to make a strategy to kill the left commander first, than whoever takes his position kill him. Now start killing the right side with same strategy until only one enemy is left at left side. Now increase your height and kill the General. You can only win if only three of your enemies are left.

Display the enemies who are left and who have been killed. Don’t forget to print your victory message.

HINT: Balancing is the key to achieve your goal.


Write a program that will ask the user If he wants to enter a number. If the user will

enter “Y” then multiply all the numbers entered by user. The program will keep on

asking the user if he wants to enter a number until he enters “N”.


2. A, e, i, o, u?

by CodeChum Admin

We've had enough about numbers, so why don’t we try evaluating characters now?


If you know how to identify what the vowel letters are, and you know how to count up to 5, then you’re good to go!



Instructions:

  1. Using a do…while() loop, continuously scan for characters (one per line) and print it out afterwards.
  2. The loop shall terminate due to either of the following reasons:
  3. The inputted character is a vowel
  4. The number of inputted characters has already reached 5.

Input

Multiple lines containing a character on each. It is guaranteed that all the characters are in lower case format.


c
f
a
b
c

Output

Multiple lines containing a character on each.


c
f
a

Write a program in c# that will accept 10 numbers. The program will then compute and display the sum of the odd numbers and also even numbers separately


write a c++ ,program to use function overloading with function template ( max two value)


Assume the following list of keys: 28, 18, 21, 10, 25, 30, 12, 71, 32, 58, 15 This list is to be sorted using insertion sort as described in this chapter for array-based lists. Show the resulting list after six passes of the sorting phase—that is, after six iterations of the for loop.


Assume the following list of keys: 28, 18, 21, 10, 25, 30, 12, 71, 32, 58, 15


This list is to be sorted using insertion sort as described in this chapter for


array-based lists. Show the resulting list after six passes of the sorting


phase—that is, after six iterations of the for loop.

Assume the following list of keys: 16, 38, 54, 80, 22, 65, 55, 48, 64, 95, 5,


100, 58, 25, 36


This list is to be sorted using quicksort as discussed in this chapter. Use


pivot as the middle element of the list.


a. Give the resulting list after one call to the partition procedure.


b. Give the resulting list after two calls to the partition procedure

LATEST TUTORIALS
APPROVED BY CLIENTS