I think that the answer is: A executable
Add the following constants in the class definition, before the main method:
private final static float START_COST = 1.5f;
private final static float HIGH_TARIFF = 0.5f;
private final static float LOW_TARIFF = 0.25f;
private final static int FIXED_MINS = 2;
private final static int HIGH_TARIFF_MINS = 10;
Then add this to the main method you already had:
float price = START_COST;
if (x > FIXED_MINS) {
if (x <= HIGH_TARIFF_MINS) {
price += HIGH_TARIFF*(x-FIXED_MINS);
}
else {
price += HIGH_TARIFF*(HIGH_TARIFF_MINS-FIXED_MINS)
+ LOW_TARIFF*(x-HIGH_TARIFF_MINS);
}
}
System.out.printf("A %d minute call costs %.2f", x, price);
Answer:
The definition of function is as follows:
def typing_speed(number_of_words,Time_Interval):
number_of_words>=0
Time_Interval>0
speed=float(60*number_of_words/Time_Interval)
return speed
Explanation:
Above function is defined step-by-step as follows:
def typing_speed(number_of_words,Time_Interval):
- A function named typing speed has two arguments, num_of_words and Time_Interval.
number_of_words>=0
Time_Interval>0
- The variable number_of_words is the number of words entered that a person enters, they must be greater than or equal to 0. Where as Time_Interval is the variable for counting the time span in seconds, it must be greater than 0.
speed=float(60*number_of_words/Time_Interval)
return speed
- For determining result firstly the seconds are converted int minutes by multiplying with 60 and number_of_words is divided with Time_Interval in order to get words per minute. The return value will give speed which has data type float.
Answer:
C. Plan worksheet objectives
Explanation: