CSCI 150, Spring 2003

Home | | Course Schedule | | Assignments | | Lecture Notes

Homework 1 solution

{Program: journey.pas
Author: Brenda Student
Class: CSCI 150, Section 01
Date: 1/31/03
Assignment: Homework 1
Purpose: Asks a few questions and repeats the answers in a sentence format}

program journey;
var
	name: string;	        {User's name}
	destination: string;	{where the user is going}
	miles: integer;         {Distance the user has traveled}
begin
	writeln;
	writeln('Hi there! What is your name?');
	readln(name);
	writeln('Where are you going?');
	readln(destination);
	writeln('How far have you traveled (in miles)?');
	readln(miles);
	writeln;
	writeln('Let me see if I have this straight:');
	writeln(name, ' has traveled ', miles * 1760, ' yards on the way to ', destination, '.');
	writeln;
	writeln('Thanks for running the program.');
end.