Question

- w each bill. Design a flowchart or pseudocode for the following: A program that accepts the following data about one custom please use flowgorithm program to do the flowchrat.



6. The Dash Cell Phone Company charges customers a basic rate of $5 per month to send text messages. Additional rates are as those are the data that are in the question.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

package lecture;
import java.util.*;
public class MessageCharge {

   public static void main(String[] args) {
       // TODO Auto-generated method stub

while(true)
{
   System.out.println("enter the three digit area code(-1) to exit: ");
Scanner sc=new Scanner(System.in);
int areacode=sc.nextInt();
   if(areacode<0)
   {
   System.out.println("Now exiting the code ");
   System.exit(0);
   }     
int count=0,r,ph,charge1=0,charge2=0,charge3=0,messagecount1;
int tempareacode=areacode;

       while(tempareacode>0)
       {
           r=tempareacode%10;
           count++;
           tempareacode=tempareacode/10;
       }

       if(count!=3)
           System.out.println("wrong areacode(not three digit) re-enter all data please ");
       else
       {
           count=0;
           System.out.println("enter your seven digit phone number: ");
           ph=sc.nextInt();
           int tempph=ph;
           while(tempph>0)
               {
               r=tempph%10;
               count++;
               tempph=tempph/10;
               }
               if(count!=7)
           System.out.println("wrong mobile number(not seven digit)re-enter all data please ");
               else
               {
                   System.out.println("enter the number of text messages sent: ");
                   int messagecount=sc.nextInt();
                   if(messagecount>300)
                   {
                       messagecount1=messagecount-300;
                       charge1=messagecount1*2;
                       charge2=199*3;
                       charge3=500;
                   }
                   else if(messagecount>100 && messagecount<=300)
                   {
                       messagecount1=messagecount-100;
                       charge1=messagecount1*3;
                       charge2=500;
                   }
                   else
                   {
                       charge1=500;
                   }
                   double amountpaid=charge1+charge2+charge3;
                   double dollar=((int)amountpaid)/100;
                   double cent=amountpaid%100;
                  
                   System.out.println("---------before tax-----------");
                   if(dollar>=1)
                   {
                       System.out.print("dollar: "+dollar);
                       System.out.println(" cent: "+Math.round(cent));
                   }
                   else
                   {
                       System.out.println(" cent: "+Math.round(cent));
                   }
                   System.out.println("------------after tax--------- ");
                   double tax=(amountpaid*14)/100;
                   amountpaid=amountpaid+tax;
                   dollar=(int)amountpaid/100;
                   cent=amountpaid%100;
                   if(dollar>=1)
                   {
                       System.out.print("dollar: "+dollar);
                       System.out.println(" cent: "+Math.round(cent));
                   }
                   else
                   {
                       System.out.println(" cent: "+Math.round(cent));
                   }
      
               }
       }
     


}
   }

}

enter the three digit area code(-1) to exit: 121 enter your seven digit phone number: 1234567 enter the number of text messag

FLOWGORITHM FOR MAIN LOGIC OF PROGRAM

SAC false мм 5100 & <=300 charger msg count! = msg count-300 chargel = husg comf 1*2; charge 2 = 199*3; charge 3 = 500 messag

DON'T FORGET TO LIKE.

THANKS BY HEART.

Add a comment
Know the answer?
Add Answer to:
please use flowgorithm program to do the flowchrat. those are the data that are in the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • You will create flowchart using Flowgorithm and Pseudocode for the following program example:&nbs...

    you will create flowchart using Flowgorithm and Pseudocode for the following program example:   Pet Care is a doggy day care that would like you to create a program that accepts the dog owner's name pet's name, breed, age and weight of the dog. The program should allow the user to enter this data until a sentinel value is reached. Then it will display the dog's name if the dog weighs less than 20 pounds or more than 100 pounds (be...

  • create flowchart using Flowgorithm and Pseudocode for the following program example: Pet Care is a doggy...

    create flowchart using Flowgorithm and Pseudocode for the following program example: Pet Care is a doggy day care that would like you to create a program that accepts the dog owner's name, pet's name and weight of the dog. The program should allow the user to enter this data until a sentinel value is reached. Then it will display the dog's name if the dog weighs less than 20 pounds or more than 100 pounds (be sure to use a...

  • CIST 1305 – Program Design and Development Chapter 4 Assignment #7 [Decisions/If Statements & Loops] (50...

    CIST 1305 – Program Design and Development Chapter 4 Assignment #7 [Decisions/If Statements & Loops] (50 Points) Please do the following exercises: Pastoral College is a small college in the Midwest. Design the pseudo-code for a program that accepts a student name, major field of study, and grade point average. Display a student’s data with the message “Dean’s list” if the student’s grade point average is above 3.5, “Academic probation” if the grade point average is below 2.0, and no...

  • The following program MUST be written in Flowgorithm and MUST use modules. Could someone please add...

    The following program MUST be written in Flowgorithm and MUST use modules. Could someone please add screenshots to show me how this is supposed to look in Flowgorithm? I'm confused as to how to break it up into extra functions. For the programming problem, create the flowchart and enter it into the Flowgorithm program to test the accuracy of your logic. Save the file as Ch7Lab1. Payroll Program with Input Validation Design a payroll program that prompts the user to...

  • Design a program that has two parallel arrays: a String array named people that is initialized...

    Design a program that has two parallel arrays: a String array named people that is initialized with the names of seven of your friends, and a String array named phoneNumbers that is initialized with your friends’ phone numbers. The program should allow the user to enter a person’s name (or part of a person’s name). It should then search for that person in the people array. If the person is found, it should get that person’s phone number from the...

  • Write a complete C++ program that creates a monthly bill for the text messaging. Your cell...

    Write a complete C++ program that creates a monthly bill for the text messaging. Your cell phone company provides the following three text messaging plans. Package A: Two Thumbs.   For $9.95 per month, 100 text messages are allowed. Additional text messages are 15 cents each. Package B: All Thumbs. For $14.95 per month, 200 text messages are allowed. Additional text messages are 10 cents each. Package C: Lightning Thumbs. For $19.95 per month, unlimited text messaging is provided. State sales...

  • finite mathematics an applied approach 11th edition, Sullivan, Chp 2, project page 101. // Should be in the book souliti...

    finite mathematics an applied approach 11th edition, Sullivan, Chp 2, project page 101. // Should be in the book soulitions but can't find it. 1. You decide to compare the basic charges for two cell phone plans that include texting and Web access. Here are the monthly costs for two plans.* Plan A includes a flat rate of $39.99 for 450 anytime minutes plus $.02 for each text message (sent or received) and $1.99 per megabyte of data usage (50...

  • Write a program in c++ for An electric company came out with a residential rate schedule...

    Write a program in c++ for An electric company came out with a residential rate schedule in your state. You are asked to write a program that will compute the customer’s electric bill. Program will prompt month number and Kilowatt hour used. Sample Input Screen:             Enter the month (1 - 12)                      :             Kilowatt hours used                             : The electric bill is computed using the following method: There is a flat service charge of $15.31...

  • write a program in java that determines the change to be dispensed from a vending machine....

    write a program in java that determines the change to be dispensed from a vending machine. An item in the machine can cost between 25 cents and a dollar, in a 5-cent increments(25,30,35.....,90,95,or 100), and the machine accepts only a single dollar bill to pay for the item. for example a possible dialogue with the user might be "Enter price of item (from 25 cents to a dollar, in 5-cent increments):45 you boughtan item for 45 cents and gave me...

  • write a program in C that determines the change to be dispensed from a vending machine....

    write a program in C that determines the change to be dispensed from a vending machine. An item in the machine can cost between 25 cents and a dollar, in a 5-cent increments(25,30,35.....,90,95,or 100), and the machine accepts only a single dollar bill to pay for the item. for example a possible dialogue with the user might be "Enter price of item (from 25 cents to a dollar, in 5-cent increments):45 you boughtan item for 45 cents and gave me...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT