Answer:
The solution code is written in C++
- float cellPhone(int m, int tx){
- float COST_PER_MIN = 0.1;
- float COST_PER_MESSAGE = 0.2;
-
- float bill_amount = m * COST_PER_MIN + tx * COST_PER_MESSAGE;
-
- return bill_amount;
- }
Explanation:
Firstly, declare a function named cellPhone() that takes two input parameters, m and tx (Line 1).
Since the policy of the carrier company is not given in the question, I make a presumption that the cost per minutes is $0.10 and the cost per message is $0.20 (Line 2- 3).
Next, apply the formula m * COST_PER_MIN + tx * COST_PER_MESSAGE to calculate the total bill (Line 5) and return the bill_amount as function output (Line 7).
Answer:
performing an online search
The answer to this question is D. This is because programming language is a language used to run the application software. A programmer or developer writes code, and the code language (most common is JavaScript) is translated and it runs the program.
Answer:
Java code is given below
Explanation:
import java.util.Scanner;
public class Prime {
public static void main(String args[]) {
int first, last, flag = 0, i, j;
Scanner s = new Scanner(System.in);
System.out.println("Enter the lower limit :");
first = s.nextInt();
System.out.println("Enter the upper limit :");
last = s.nextInt();
System.out.println("The prime numbers in between the entered limits are :");
int x = 0;
for (i = first; i <= last; i++) {
for (j = 2; j < i; j++) {
if (i % j == 0) {
flag = 0;
break;
} else {
flag = 1;
}
}
if (flag == 1) {
x++;
System.out.println(i + " ");
}
}
System.out.println("Total number of prime numbes between " + first + " and " + last + " are " + x);
}
}