CMPS 200 Homework Assignment 1, Spring 2012
American University of Beirut · Introduction to Programming · 2 pages
More CMPS 200 files
- Homework 11 · Fall 2018HomeworkView
- Homework Last Assignment · Fall 2018HomeworkView
- Homework Asst10 · Fall 2017HomeworkView
- Homework 9 · Spring 2017HomeworkView
- Homework Assignment 2 · Fall 2016HomeworkView
- Homework Assignment 5 · Fall 2016HomeworkView
- Homework Assignment 6 · Fall 2016HomeworkView
- Homework 1 · Spring 2016HomeworkView
Show the text of this homework
Faculty of Arts & Sciences
Department of Computer Science
CMPS 200—Introduction to Programming
Assignment 1 – Due Monday Oct 10, 2011
Announcements
•
The labs of sections 5 and 6 have moved from Bliss 207 to Bliss 210.
•
We will have a “Programming Clinic” open to all on Friday 2:00-4:00 in Bliss 210. This is intended to provide
additional help and you are encouraged to take advantage of it as needed.
•
The email addresses of the Lab Instructors are as follows. George Sakr: ges07@aub.edu.lb. Samah Karim:
swk10@aub.edu.lb; Gorune Ohannessian: hko00@aub.edu.lb. Khalid Dassouki: thisiskd@hotmail.com.
1. Describe what happens if you try to execute the UseArgument program with each of the following
command lines:
a. java UseArgument java
b. jave useArgument %$@#!
c. java UseArgument.java Bob
d. java UseArgument Alice Bob
2. Modify the program UseArgument.java to produce a program UseThree.java that takes three names and
prints out a proper sentence with the names in the reverse of the order given, so that, for example,
> java UseThree Alice Bob Carol gives
Hi Carol, Bob and Alice.
3. Write a program in a class named Shining that prints the following line of output 1000 times:
All work and no play makes Jack a dull boy.
You should not write a program whose source code is 1000 lines long; use methods to shorten the program.
What is the shortest program you can write that will produce the 1000 lines of output, using only the material
from Chapter 1 (println, methods, etc.)?
4. Write a program Arrows that draws the following sequence of forward and back arrows. You should write a
method that draws a forward arrow, another one that draws a back arrow. These methods may be called from
main().
5. Write a program LetterArrrow that draws an arrow using a letter given as a command line argument. Your
program should contain a method with the following signature:
public static void printArrow(String str)
that draws an arrow using a given string argument.
Introduction to Programming (CMPS 200)
Fall 2011
2 of 2
> java LetterArrow a produces
a
a
a
a
a
Submission Instructions
•
Your submission must consist of a zip archive that contains .java files and a single Word document that
contains sample runs, answers to questions, etc. The files must be zipped in a file that adheres to the
following naming convention asst0_<netid>, where <netid> stands for you AUBnet user name. These
zipped files will be processed automatically so please make sure you use this naming convention. The single
zipped file must be uploaded to Moodle.
•
Please make sure there are no folders or subfolders in your submitted zip file. When the zip is opened, you
should only see .java files and a word file at the top level. Please check your zip before submission.
•
We are still getting questions on how to show sample runs in your Word file. There are many ways to do so.
You could capture the command window Ctrl-Alt-PrtScreen and paste it using Ctrl-V. An alternative is to right
click in the command window and select “Mark”. You can then select the content you need, right click to save
the marked content on the clipboard, and then paste it into a Word document.