Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I. Writing an Algorithm As you arrive at the Engineering and Computer Science Library in Head Hall, you meet your friend in the doorway as

I. Writing an Algorithm
As you arrive at the Engineering and Computer Science Library in Head Hall, you
meet your friend in the doorway as they are exiting the library. Your friend notes that
there is a tutoring session starting shortly in the Faculty of Computer Science
Foundation Course Tutoring space (Gillin Hall E128). She would like to go to the
tutoring but isnt sure how to get to that room.
Describe an algorithm that your friend can follow to get from the door of the
Engineer and Computer Science Library to the door of G-E128.
Create a new heading in your report document for question I. Below that, type the
algorithm that your friend should follow. No Java code is required here; describe
each step in English (refer to your notes & the posted course materials for examples
of algorithms). Number each step.
II. Puzzle Problems:
Create a new heading in your report document for question II. Type the solutions to
each of the puzzles described below. Again, no Java code is required here; describe
each step in English and number each step. You do not need to include any
images/drawings with your solutions; we just need the numbered steps (in English).
Part A:
Four house leaders are at the Student Union Building (SUB) when they suddenly realize
that House Dodge Ball is being held at the Currie Center and is starting in 15 minutes.
Luckily, one of them has a tandem bicycle which will allow two people to ride the
bicycle together. When two people are riding the bicycle together, they can only
travel as fast as the slowest person. One person must then return to the rest of the
group with the bicycle. The Babbage house leader can make the trip in one minute,
the Hopper house leader takes two minutes to make the trip, the Knuth house leader
takes five minutes, and the Turing house leader takes eight minutes. Write an
algorithm that describes how all the house leaders will get to the Currie Center on
time.
Note: the house leaders must remain at the SUB to wait for the bicycle. Walking or
other modes of transportation to the Currie Center is not an option.
Part B:
At a CSA Pancake Breakfast you see three plates lined up on the counter. The first
(left-most plate) has a stack of 3 pancakes on it. The other two plates (the middle
plate and the right-most plate) are empty. The stack of pancakes on the first plate is
arranged so that the largest pancake is on the bottom of the stack, the medium-
sized pancake is in the middle, and the smallest pancake is on the top. Your goal is to
move the stack of pancakes to the right-most plate. However, you need to follow
these rules:
You can move only one pancake at a time, from one plate to another;
You can only move the top-most pancake from any stack; and
A pancake can never rest on another pancake smaller than itself.
Write an algorithm to describe how you will achieve your goal. Note: The optimal
solution only requires 7 moves.
III. Programming Question:
NOTE: Before doing this question, you should complete at least part of the Lab #1
exercise (as it steps you through how to write, compile and run a Java program).
Specifically, that you complete the first three Lab #1 sections before attempting this
question.
Open your text editor. Write a Java class, named Initials, that displays your initials
as block letters. For example:
********
******
******
**********
*****
****
****
****
Your program will be very similar to MyFirstProgram.java from Lab #1, except the
name of the class will be different and the println() statements will be different.
(Include the @author tag with your name and student number in a javadoc
comment at the start of your class.)
Be sure to save this Java program in the folder with all of your other files for this
assignment.
Once your program is working correctly, capture an image of the
terminal/Command Prompt window to save for submission. (Note: You might want to
adjust the size of your terminal/Command Prompt window before capturing the
image to make sure that it will be legible when you insert it into your report.) Give this
image file a descriptive name (e.g. Assign1Q3.png).
Create a new heading in your assignment report document for question III and copy
the Java source code for your program into the document. (Be sure to use a
monospaced font for the program source code). Add the image of the
terminal/Command Prompt window that you captured to the report as well (& check
to make sure it is legible.)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions