I'm doing this assignment for my Java class but each time I run the program I get a error. This is the problem. CODE A PROGRAM THAT PROVIDES THE NUMBER OF TEXT MESSAGES A USER SENT LAST MONTH AND THEN DISPLAYS THE BILL, INCLUDING THE NUMBER OF TEXT MESSAGES SENT, THE SUBTOTAL AND THE TOTAL. MESSAGES COST 25 CENTS EACH, AND 9 PERCENT TAX IS CHARGED ON THE TOTAL. USE YOUR LOGIC & DESK CHECKING DATA FROM LAB ASSIGNMENT 1.
This is my pseudocode I did.
start
num textmessages
num billSubtotal
num totalBill
num COST_PER_MESS = 0.25
num TAX_RATE = 0.09
output “Enter the number of messages sent >>”
input messages
billSubtotal = messages * COST_PER_MESS
Total=BillSubtotal*TaxRate
output “The total bill for”, messages,
“messages sent is”, totalBill
stop
// GROUP #: 9
// GROUP LAB ASSIGNMENT #: 3
// PROBLEM #: 7
// PROGRAM-NAME: MessageBill.java
//****************************************************
import.java.util.Scanner;
public static void main (String[] args) {
final int TAX_PERCENT = 9;
final double COST_PER_MESSAGE = 0.25;
Scanner input = new Scanner(System.in);
int numOfMessages;
double subTotal, Total, tax;
tax = (subTotal * TAX_PERCENT / 100);
//prompt and read number of messages
//calculate the Subtotal
//calculate the tax
//calcualate the total
//display the bill
System.out.println("Number of message sent: + numOfMessages");
System.out.println("Subtotal: $" + subTotal);
System.out.println("Tax: $" + tax);
System.out.println("Total: $" + Total);
input.close();
CODE A PROGRAM THAT PROVIDES THE NUMBER OF TEXT MESSAGES A USER SENT LAST MONTH AND THEN DISPLAYS THE BILL, INCLUDING THE NUMBER OF TEXT MESSAGES SENT, THE SUBTOTAL AND THE TOTAL. MESSAGES COST 25 CENTS EACH, AND 9 PERCENT TAX IS CHARGED ON THE TOTAL. USE YOUR LOGIC & DESK CHECKING DATA FROM LAB ASSIGNMENT 1.
not in particular order,
1 - create a static variable(counter) which can be incremented each time a text has been sent
2 - create a variable to hold the total cost each time the counter is incremented add 25c (+=) to the amount
3 - before displaying the bill add the 9% tax onto the bill before displaying it to the user.
also don't do this all in the main method,create a class called PhoneBill or something and then you can also have individual phone bills.