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 C++ program for the following specification: Create a class Fuzzy with two


data members: x of type integer and memx of type float. memx should range from 0 to 1. Implement the operator overloading for the operators: &, I and ~. i. Operator function for & should return the Fuzzy object with minimum memx, after checking the equality of data member x in both objects.


Sample Data:


f1 (10,0.5) f2= (10,0.2)


f1&f2= (10,0.2) ii. Operator function for should return the Fuzzy object with 1-memx..


Sample Data:


f2=(10,0.2) ~f2=(10,0.8)


Implement the appropriate member functions to get the input and print the output.


Note: In & operator overloading, if x is not equal, then return fuzzy object (0,0)


Imagine a tollbooth at a bridge. Cars passing by the booth are expected to pay a 50

cent toll. Mostly they do, but sometimes a car goes by without paying. T Model this tollbooth with a class called tollbooth. The two data items are a

type unsigned int to hold the total number of cars, and a type double to hold the total

amount of money collected. A constructor initializes both of these to 0. A member

function called payingcar() increments the car total and adds 0.50 to the cash total.

Another function, called nopaycar(), increments the car total but adds nothing to the

cash total. Finally, a member function called display() displays the two totals. Make

appropriate member functions const. Include a program to test this class. This program should allow the user to push one key to count a paying car, and another to count a nonpaying car. Pushing the ESC key should cause the program to print out the total cars and total cash and then exit.


Trapezium Order
you are given an integer N . print N rows starting from 1 in the trapexium order as shown in the output of the below examples .
Input
the input contains an integer N
OUTPUT
the output should have N lines
each of the N lines should have space -seperated integers as per the trapezium order
SAMPLE INPUT 1
4
SAMPLE OUTPUT 1
1 2 3 4 17 18 19 20
5 6 7 14 15 16
8 9 12 13
10 11
NUMBERED TRIANGLE
you are given an integer N. print N rows starting from 1 in the triangle order as shown in the explanation.
INPUT
the input contains an integer N .
OUTPUT
the output shoudl have N lines .
Each of the N lines should have space -seperated integers as per the traingle order.
EXPLANATION
given N = 5
the triangle order for the given N is
1
2 6
3 7 10
4 8 11 13
5 9 12 14 15

Suppose we have 999 records of employees Emp1, Emp2, Emp5, Emp6 and so on up to Emp998 and Emp999 stored in a sequence. Hence, records are nothing but a row in the table. In the employee table, we want to insert new records Emp3 and Emp4 in the sequence, and once we have done insertion we need to update and retrieve the record efficiently to optimize the performance of a database by minimizing the access time when query is being executed.

You are required to solve the problem with the index sequential access method with pros and cons in the given scenario.



Create a class Time with data members – Hours(int), Minutes(int) and Seconds(int). Include two

constructors – (i) to initialize the data members to zero, and (ii) to initialize the data members with

the values passed as arguments. Include two member functions – (i) AddTime() to add two objects

passed as parameters and set the invoking object with this result (ii) DispTime() to display the time

in the format hh:mm:ss. The main() program should create two initialized Time objects and one that

is not initialized. Add the two initialized values leaving the result in the third Time object. Display the

values of the third object.


Create a class Book that contains instance variables like BKName, BKId and BKAuthor, a

parameterized constructor to initialize its instance variables, a method BKUpdateDetails(String name,

int id, String author), that accepts new values for name, Id and author as parameters and updates

the corresponding instance variable values of that object and another method BKDisplay() to display

the book details. Create a class BookDemo and provide main method for instantiate a Book object,

display the original book details, update its details with new values, and display the updated book

details


Design a class named Employee with following properties: name, employee ID and salary. Add

necessary constructors to initialize the data members. Add two methods, (1) Update(salary) to modify

the salary for the employee object and (2) Display() to print the employee details on screen. In main,

read an employee’s details from user, construct employee object from the user input, update

employee’s salary by calling appropriate function and display the employee’s details.


Create a class Vehicle with the following attributes: Registration Number, Model, Manufacturer,

Manufacturing Date, Engine number and Colour. Add a behaviour to change the colour and display

the updated Vehicle details.


Create the Class Book with the following attributes: Book ID, Title, Authors, Unit Price. Print the

current details of the book. Add a behaviour to modify the price and display the updated book details.

Display the total Amount to be paid for each Book, using unit price & 12% tax. Implement using OO

concepts.


LATEST TUTORIALS
APPROVED BY CLIENTS