Chris Pollett >
Old Classes >
CS146

   ( Print View )

Grades: |Sec6|Sec8|

Course Info: Homework Assignments: Practice Exams:
                           












HW #1 Page

HW#1 --- last modified January 16 2019 00:35:12..

A solution set is posted here.

Due date: Sept. 17 start of class. 
========= 

Files to be submitted: cs146sec6hw1.java (for section 8 will be  
====================== cs146sec8hw1.java) Send the file to me as 
                       an e-mail attachment.
                       If you want you may call your file
                       cs146sec6hw1file1.java

                       Also turn in on paper start of class the 
                       following problems out of 
                       the book: 2.7, 2.8, 2.12, 2.14.

Purpose: To test your ability to write a simple Java program,
======== to gets some experience with O-notation, and to learn 
         about Horner's rule.

Specification: 
==============
Besides the book problems listed above you will also need to 
write a program for problem 1.6 out of the book. This program will 
be run from the command line. For instance,

java cs146sec6hw1 abc

should output

abc acb bac bca cab cba

The way the program should work is that cs146sec6hw1's main (we 
will allow the driver classes containing main to begin with 
lower case but otherwise strictly enforce the naming convention)
calls the method permute(args[0]) where permute is the public 
method from the problem description. You are allowed to make both
permute functions static.

Please note both versions of permute should be methods
of the class cs146sec6hw1. No exceptional cases need to 
be handled for this homework.


Point Breakdown
===============
2.7...................................1pt
2.8...................................1pt
2.12..................................1pt
2.14..................................1pt
Coding guidelines followed............1pt
Output is correct on test cases.......1pt
private permute works.................1pt
public permute works..................1pt

Total.................................8pts                          

A solution set is posted here.