1. Write a C++ program that prompts the user for the fuel quantity and the fuel price
per litr
Task:1
A single point has two coordinates p1(x,y). Create a class name Point with a length 2 array asit's private data member. Initialize the array using constructor. Overload array subscript operator ‘[ ]’ for if I have to access the object's array at a particular index from main function
like this.
Point p1(1, 1);
cout << p1[0] << " " << p1[1] << endl;
Task#02:
Copy paste the same task and do consider doing it in dynamic memory instead of static. Plus alter the subscript overloaded function for if I have to make changes to the class array from the main function. Hint: By reference
Point p2(3, 3);
cout << p2[0] << " " << p2[1] << endl;
p2[0] = 7;
p2[1] = 9;
cout << p2[0] << " " << p2[1] << endl;
Digit 9
Class=1 If sales is equal to or less than $1000, the rate is 6 percent. If sales is greater than $1000 but less than $2000, the rate is 7 percent. If the sales is $2000 or greater, the rate is 10 percent. Class=2 If the sales is less than $1000, the rate is 4 percent. If the sales is $1000 or greater, the rate is 6 percent. Class=3 The rate is 4.5 percent for all sales amount Class=any other value Output an appropriate error message
Write a Program: Competition Score
Your goal is to create a program that will determine the average score for an
athlete in a competition. There are 10 judges who each award a score between 0 and 10. The lowest and highest scores are thrown out, and the athlete’s score is the average of the eight remaining scores. The scorecard should have the first and the last name of the athlete on the first line and 10 space-separated numbers between 0 and 10 on the second line. The numbers should have at most 1 digit after the decimal point.
Example Input File:
Mirabella Jones
7.5 8.8 7 8.1 8 9.8 9.3 8.9
Example Output:
First run
ERROR: the scorecard could not be opened
Second run
Insufficient scores
Mirabella Jones is disqualified
Third run
Invalid scores
Mirabella Jones is disqualified
Fourth run
Mirabella Jones's results:
7.5, 8.8, 7.0, 8.1, 8.0, 9.8, 9.3, 8.9
The highest score of 9.8 and the lowest score of 7.0 were dropped
The average score is 8.59
How to calculate arithmetic in python programming
Let’s build a sample banking program to perform the common tasks like Withdraw and Deposit.
In this question, you are required to write C++ code that checks whether the number
entered by the user is a happy number or not for 10 cycles/iterations only.
Example: Assume a number 19
Number Computation Result cycle/iterations
19 1
2 + 9
2 82 1
82 8
2 + 2
2 68 2
68 6
2 + 8
2 100 3
100 1
2 + 0
2 +0
2 1 4
Create a C# console application that prints the Area of a square.
The application must use OOP concepts:
Create an abstract class named ShapesClass.
ShapesClass must contain an abstract method named Area.
Create a class named Square that inherits from ShapesClass.
Square class must contain a Square method.
Create a method named Area that will override abstract method Area, and then return the sides of the square.
In the main method create an object of the square class, with the value of the side. Print the Area of the square.
How to convert basic data to user defined data type?