direction

a. Your algorithm should be written both in pseudocode and flow chart.

b. You have to show each and necessary steps considered to solve each problem

1. Mr. Abdi began his trip from Woliso to Finfinne; he filled his car's tank with gas and reset its trip meter to zero. After travelling 50 KM, Mr. Abdi stopped at a gas station to refuel; the gas tank required 10 gallons. Create an algorithm that Mr. Abdi can use to display his car's gas mileage-the number of Kilometers his car can be driven per gallon of gas-at anytime during the trip.

a. Pseudocode:

1. Initialize variables:
- totalKilometers = 0
- totalGallons = 0

2. Reset trip meter to zero

3. Loop until trip is completed:
a. Input number of kilometers driven
b. Add the number of kilometers driven to totalKilometers
c. Input number of gallons filled
d. Add the number of gallons filled to totalGallons
e. Calculate gas mileage (Kilometers per gallon) as totalKilometers / totalGallons
f. Display gas mileage

b. Flowchart:

Start -> Initialize variables -> Reset trip meter to zero -> Loop until trip is completed -> Input number of kilometers driven -> Add kilometers to totalKilometers -> Input number of gallons filled -> Add gallons to totalGallons -> Calculate gas mileage -> Display gas mileage -> Loop back if trip is not completed -> End.

Each step is necessary to keep track of the total kilometers driven and total gallons filled during the trip. The gas mileage is calculated by dividing the total kilometers by the total gallons. This algorithm allows Mr. Abdi to display his car's gas mileage at any time during the trip.