Programming Projects-Gas Project - Pascal programming

Gas Project

The fuel consumption of a vehicle is to be analyzed. Each time fuel is obtained, the tank is filled and a record is made of the date, present mileage, gallons used, total cost and brand name as shown:

Gas Project

This data is to be analyzed in the following ways.

  1. Compute the overall miles per gallon (MPG).
  2. Compute the MPG at each refill.
  3. Determine the cumulative MPG at each fill up by dividing the mileage to fill up, by the accumulated gallons.
  4. Compute the running average over the 3 previous refills.
  5. Compute the maximum MPG and the minimum MPG.
  6. Determine which brand produces the maximum MPG between fill ups.
  7. Compute the MPG for each brand.
  8. Determine which brand produces the minimum cost per mile.
  9. Determine which brand has the minimum cost per gallon.
  10. Compute the average fuel cost per day traveled.
  11. Determine the days of minimum mileage.
  12. For each brand, compute the total number of gallons used, and the overall average MPG, cost per gallon.
  13. Convert some of the above to other units (kilometers per liter, marks per kilometer, liters per 100 kilometers).
  14. Produce plots of some of the above results.

Library Projects

  1. IntArrayLib2

    Create another IntArrayLib where a terminating value is stored in the first position of the array and also in the last position.

  2. Complete ComplexLib

    Complete the Complex Library by providing procedures for Division, Subtraction, Conjugation, and functions to provide the Magnitude and Angle of the complex numbers.

  3. New DateLib

    Re implement the DateLib of Chapter using a Date-type that is a record.

  4. AccountLib

    Create a library of Accounts (in a bank, organization, etc.) where each account is a record consisting of an IdNumber, a Balance, and various transactions of Withdrawal and Deposit.

BSL: Big Stat Lab

In this lab we will reuse library IntArrayLib, which operates on a list of INTEGER values as shown in this chapter. You will create some of the following additional procedures involving arrays, and use them and reuse them to do some of the statistical operations.

  1. MaxIntSeq(S, M, P) is a procedure that computes the maximum value M of a sequence S of Integers and also returns the position P of this maximum value.
  2. SelectSort(S) is a procedure that sorts the values of S into decreasing order. Use MaxIntSeq to create SelectSort.
  3. MidIntSeq(S) is a function that returns the middle value of a sequence L; if the sequence has an even number of items then the middle returned is the average of the two middle values.
  4. CountIntSeq(S, V, C) is a procedure that counts the number of occurrences C of the value V in the sequence S. For example, it could count the number of values of zero rainfall, or the number of days that had the maximum rainfall.
  5. MeanIntSeq(S) is a function procedure that returns the average value of any sequence S.
  6. Variance(S) is a function that returns the amount of deviation from the mean value of a sequence. The algorithm for this is shown earlier use of MeanIntSeq. Write a program that uses all these procedures. It first prompts a user to enter a sequence and then presents a menu that requests an action in the form:
Enter an action: A: to determine the Average value of a sequence C: to Count the occurrences in a sequence L: to find the Largest value of a sequence M: to find the Middle value of a sequence S: to Sort the sequence into decreasing order V: to compute the Variance E: to Exit this menu Enter a character

Time Permitting:

Put these procedures (including a Menu) into a Library, called StatLib and use this Library and IntArrayLib in a program called StatProg. Also the data involvedshould be stored in files.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Pascal programming Topics