Suppose that overSpeed and fine are double variables. Assign the value to fine as follows: If 0 < overSpeed <= 5, the value assigned to fine is $20.00; if 5 < overSpeed <= 10, the value assigned to fine is $75.00; if 10 < overSpeed <= 15, the value assigned to fine is $150.00; if overSpeed > 15, the value assigned to fine is $150.00 plus $20.00 per mile over 15.
The Unilever Company plans to allocate some or all of its monthly advertising budget of GH¢82,000 in the Mankato area. It can purchase local radio spots at GH¢120 per spot, local TV spots at GH¢600 per spot, and local newspaper advertising at GH¢220 per insertion.
The company's policy requirements specify that the company must spend at least GH¢40,000 on TV and allow monthly newspaper expenditures up to GH¢60,000.
The Admission to a professional course is done using the following conditions.
a) Marks in Maths> =60
b) Marks in Physics >=50
c) Marks in chemistry >=40
d) Total in all the three subjects >=200 (or) Total in Maths and Physics >=150
Given the marks of three subjects, write a C++ program to process the applications to list the eligible candidates. [Note: Use call by value]
Suppose that sale and bonus are double variables. Write an if...else statement that assigns a value to bonus as follows: If sale is greater than $20,000, the value assigned to bonus is 0.10; If sale is greater than $10,000 and less than or equal to $20,000, the value assigned to bonus is 0.05; otherwise, the value assigned to bonus is 0.
Correct the following code so that prints the correct message
if (score>=60)
System.out.println("You Pass.");
else;
System.out.println("You Fail.");
Write a C++ program to print all natural numbers in reverse (from n to 1). - using while loop
Implement a class named Bottle, which has two int data members; one to represent the maximum capacity of a bottle and the other to represent the quantity of liquid the bottle contains at a given time. Include the following member functions in the class Bottle:
• to set the maximum capacity of a bottle (void setCapacity(int c))
• to set the current quantity of liquid in the bottle (void setQuantity(int q))
• to access the maximum capacity of the bottle (int getCapacity())
• to access the quantity of liquid currently in the bottle (int getQuantity())
• to fill a bottle completely (void fill())
• to empty the bottle (void empty())
Write a main function to test the Bottle class. It should create at least two Bottle objects and include statements to test all the member functions of Bottle using the created Bottle objects.
Anti-Diagonals
Given a MxN matrix,write a program to print all Anti-Diagonals elements of matrix
Input
The first line of input will contain a M, N values separated by space.
The second line will contain matrix A of dimensions MxN.
Output
The output should contain anti-diagonal elements separated by a line.
Explanation
For example, if M = 4, N = 4
Matrix A:
4 4
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
So the output should be
If you want to handle 30 interrupts, how many 8259A PIC will you need?
Comment this code line by line
include <iostream>
using namespace std;
class Line {
public:
void setLength( double len );
double getLength( void );
Line();
private:
double length;
};
Line::Line(void) {
cout << "Object is being created" << endl;
}
void Line::setLength( double len ) {
length = len;
}
double Line::getLength( void ) {
return length;
}
int main() {
Line line;
line.setLength(6.0);
cout << "Length of line : " << line.getLength() <<endl;
return 0;
}