alright can u help me i tried the code
Question 1
A company is carrying out a survey by observing traffic at a road junction.
Each time a car, bus, lorry or other vehicle passed by the road junction it was noted down.
10000 vehicles were conducted during the survey.
WRITE A PASCAL CODE WHICH :
1. inputs all 10000 responses
2. outputs the number of cars, busses or lorries
3. outputs the number of vehicles that werent cars, buses or lorries during the survey
Question 2
Regis lives in brazil and often travels to USA, Europe and Japan.
He wants to be able to convert Brazilian Reais into US Dollars, European Euros or Japanese Yen.
THE CONVERSION FORMULAE IS:
currency value = number of reais*conversion rate
Write a pascal code which inputs the country he is visiting, exchange rate and amount in brazilian reais he is taking.
The output will be a value inn foreign currency or the name of the currency.
QUESTION 1 ANSWER
PSEUDOCODE
Cars,bus,lorry = 0;
input vehicle
for count = 1 to10000
case vehicle of
car:=car+1
bus:=bus+1
lorry:=lorry+1
otherwise vehicle+1
end case
next count
output car,bus,lorry,vehicle
PASCAL CODE FOR QUESTION 1
var
car:integer=0;
bus:integer=0;
lorry:integer=0;
vehicle:integer;
begin
for vehicle=1 to 10000 do
case vehicle of
car:=car+1
bus:=bus+1
lorry:=lorry+1
else
vehicle:=vehicle+1
end;
readln;
end.
QUESTION 2 Psuedocode
input number of reais,conversion rate,country
currency value = number of reais*conversion rate
if country = USA then
output currency = $
if country = europe then
output currency = euro
if country = japan then
output currency = yen
else error
BUT I DONT KNOW HOW TO WRTE THE PASCAL FOR QUESTION 2