[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
Solved

# Beginning Pascal

Posted on 2000-02-21
Medium Priority
202 Views
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?');
if billnum  <9 then
else writeln('The system can calculate as many as 8 bills at a time.  Please enter 8 or less bills');

end.

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

Thanks a million !!!
0
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

LVL 1

Accepted Solution

nrico earned 400 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
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

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

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
###### Suggested Courses
Course of the Month12 days, 21 hours left to enroll