Solved

Beginning Pascal

Posted on 2000-02-21
2
196 Views
Last Modified: 2010-04-04
My assignment is to write a program that does the following:
Ask the user how many bills they are entering for calculation?
Have the user enter as many as 8 bills (the amount of each bill)
then add all the bills to get a total then get the average.
I understand how to get the total and average.
I also can get the user to enter how many bills they want to enter.
this is what I have so far --
begin

      writeln('How many bills will you be entering today?');
      readln(billnum);
      if billnum  <9 then
      else writeln('The system can calculate as many as 8 bills at a time.  Please enter 8 or less bills');
         readln;

end.

Can anyone help with creating a loop that will allow the user to enter the amounts of each bill???

Thanks a million !!!
0
Comment
Question by:jennyg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
nrico earned 100 total points
ID: 2550830
Okay, this isn't too hard. (But technically, I have to mention the EE is NOT for homework assignments...)
____________________________________

Uses SysUtils;

Var
  Counter,Total:Integer;
  Input:String;

Begin
{ ... Your code goes here ... }
  Total:=0;
  For Counter:=1 To Billnum Do
  Begin
    Write('Please enter bill #',Counter,':');
    ReadLn(Input);
    Total:=Total+StrToInt(Input);
  End;
  WriteLn('Total is ',Total);
  WriteLn('Average is ',Total / Billnum);
End;

Actually, you can read the input directly as an integer (Given you use integers for your bills, if you want to use floating point numbers you have to use "Real"s), then you don't have to use StrToInt();

Success!
0
 

Author Comment

by:jennyg
ID: 2551086
Thanks nrico,
This information was very helpful.  In the past I have used EE to help me with my home work assignments.  I really don't expect people to give me the answers, but people have pointed me to web sites that have the information I am looking for and that has been very helpful.
Thanks again !!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi IDE crash without error message ... 7 116
Create a path if not exists 7 108
scroll down TListBox component in Delphi 1 31
Firemonkey how to swip panel with finger tap 1 20
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question