Question

In: Computer Science

A phone company charges 0.25 AED per minutes for the first 100 minutes and 0.45 AED...

A phone company charges 0.25 AED per minutes for the first 100 minutes and 0.45 AED for each extra minutes.

The company also rewards customers with points. If the bill is less than or equal to 20.00 AED, 10 points will be rewarded, otherwise, 1 point will be rewarded for each 2 AED.

Write a Java Program to prompt the user to input the number of minutes he/she used, then output the bill amount and number of points rewarded. Note that points should be presented as integer numbers.

Java language

run=

Enter the number of minutes: 124

The bill is: 35.8

The number points awarded is: 17

BUILD SUCCESSFUL (total time: 6 seconds)

run:

Enter the number of minutes: 45

The bill is: 11.25

The number points awarded is: 10

BUILD SUCCESSFUL (total time: 4 seconds)

Solutions

Expert Solution

The code for executing the above problem is given below

// import the Scanner class

import java.util.Scanner;

// A class is created

public class BillGenerator {

//A method is created for generating the reward points
static void rewardedPoint(double aed){

//condition checking
if(aed <= 20){

//Print the awarded points as 10 if AED is less than 20
System.out.println("The number of point awarded is:" + 10);
}
else{
double awardedPoint = aed / 2;

//Double value is converting to integer value.
int awardPoint = (int) awardedPoint;

//Printing the total rewarded points if AED is greater than 20.
System.out.println("The number of point awarded is:" + awardPoint);
}
  
}
//Main method is created  
public static void main(String[] args) {

//scanner for reading value from the user
Scanner myObj = new Scanner(System.in);

//Two variables were declared
int minute;
double aed = 0;
  
System.out.print("Enter the number of minutes:");
minute = myObj.nextInt();

//If the condition satisfy then the aed value will be calculated.
if(minute <= 100){
aed = minute * 0.25;
}

//Condition not satisfy then the below statements will execute
else{
double extraMinute = (minute - 100);
aed = (100 * 0.25) + (extraMinute * 0.45);
}

//The total AED will print
System.out.println("The bill is: "+ aed);
//calling the rewarded point method to calculate the rewarded point by passing the AED value.
rewardedPoint(aed);
}

}

OUTPUT 1:

Enter the number of minutes: 124

The bill is: 35.8

The number points awarded is: 17

OUTPUT 2:

Enter the number of minutes: 45

The bill is: 11.25

The number points awarded is: 10

The screenshot of the code and the output are given below.

OUTPUT 1:

OUTPUT2:


Related Solutions

A friend or yours is considering two cell phone service providers. Provider A charges $100 per...
A friend of yours is considering two cell phone service providers. Provider A charges $100 per month for the service regardless of the number of phone calls made. Provider B does not have a fixed service ree but instead charges $1 per minute for calls. Your friend's monthly demand for minutes or calling is given by the equation p-120-30P, where P is the price of a minute.  With Provider A, the cost of an extra minute is 5 _______ .with...
The Dash Cell Phone Company charges customers a basic rate of $5 per month to send...
The Dash Cell Phone Company charges customers a basic rate of $5 per month to send text messages. Additional rates are as follows: The first 100 messages per month, regardless of message length, are included in the basic bill. An additional three cents are charged for each text message after the 100th message, up to and including 300 messages. An additional two cents are charged for each text message after the 300th message. Federal, state, and local taxes add a...
Digicom is a wireless services company with a monthly demand for cell phone minutes for each...
Digicom is a wireless services company with a monthly demand for cell phone minutes for each client that can be expressed as follows: P = $2 – 0.02Q Where P is the price paid by the client per minute and Q is the number of minutes bought by the client each month. The marginal cost is $0.20 per minute. Assume now that Digicom offers a two-part tariff with a monthly fixed fee and a per minute charge. What is the...
First The sales department of a cellular phone company pays its salespeople $1,500 per month plus...
First The sales department of a cellular phone company pays its salespeople $1,500 per month plus 25 percent of each new subscriber’s first month’s billings. A new subscriber’s first-month bill averages $80. Salespeople work 160 hours a month (four weeks at 40 hours per week). If salespeople work more than 160 hours per month, they receive $12 per hour for hours in excess of 160. Sales leads for the sales department are generated in a variety of ways—direct mailings to...
Historically, evening long-distance calls phone calls from a particular city have averages 12 minutes per call....
Historically, evening long-distance calls phone calls from a particular city have averages 12 minutes per call. In a random sample of 20 calls, the sample mean was 10.7 minutes per call with a standard deviation of 4 minutes. Does the sample indicate a change in the mean duration of long distance calls? Test the hypothesis at 10% level of significance, state the hypothesis and report your conclusion. a. estimate the p-value and show your work.
In the market A the price a company charges per product is $ 20 and its...
In the market A the price a company charges per product is $ 20 and its marginal cost is $ 10. In market B, another company sells a product at $ 30 and its marginal cost is $ 20. i) Who has greater market power company A or company B? ii) If we now know that the elasticity of demand is -2 in the market A and -0.3 in the market B. Who has greater market power? Why?
A company plans to pay a dividend of $0.50 per share next year rising by $0.25...
A company plans to pay a dividend of $0.50 per share next year rising by $0.25 per year until it reaches $2.50, at which point it will remain flat forever. If the discount rate is 9% per year, what is the present value of the dividends, i.e. the value of a share of stock?
Suppose a company charges an annual premium of $100 for an insurance policy for minor injuries....
Suppose a company charges an annual premium of $100 for an insurance policy for minor injuries. Actuarial studies show that in case of an injury claim, the company will pay out an average of $900 for outpatient care and an average of $3000 for an overnight stay in the hospital.They also determine that, on average, each year there are five claims made that result in outpatient care for every 1000 policies and three claims made that result in an overnight...
First, read the article “Copyright Lawsuit Boom." The amount that an insurance company charges for a...
First, read the article “Copyright Lawsuit Boom." The amount that an insurance company charges for a policy is known as the “premium” of the policy. When an insurance company sells a policy to a certain type of customer, it sets the premium so that the expected future payments to the policy holder as a result of his or her insured losses are not more than the amount of premium collected from the policy holders over the period. For example, if...
1. The Hill Company produced 5,000 units of X. The standard time per unit is 0.25...
1. The Hill Company produced 5,000 units of X. The standard time per unit is 0.25 hours. The actual hours used to produce 5,000 units of X were 1,350 hours. The standard labor rate is $12 per hour. The actual labor cost was $18,900. What is the total direct labor cost variance? a. $1,200 unfavorable b. $3,900 unfavorable c. $1,400 unfavorable d. $2,700 unfavorable 2. The cost associated with the difference between the standard quantity and the actual quantity of...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT