CSCI 1226 sampleAssignments


Assignment #1:

Write a program that prints out your profile using a series of hardcoded output statements such as:
System.out.println("Name: Lingras, Pawan Student Number: 9899786");
Sample output:

###################################################################
 Assignment #1 submitted by Pawan Lingras, Student Number: 7777777
 The program prints out author's profile
###################################################################
 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Name: Lingras, Pawan Student Number: 9899786
 Local Address: 923 Robie Street
 Phone: 555-1983 (Home) 420-5798 (Work)
 
 Registered in Lecture Section A and Lab Section A
 
 Faculty: Science Major: CSCI
 
 Other course taken:
 CSC203 1984 Regina A+
 
 
 Other Computer Related Experience:
 I have worked on different computer platforms.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Your header will, of course, use your name and student ID.
Zip and submit all the Java files and class files used in this assignment.


Assignment #2:

Write a program that accepts two numbers as input and outputs their addition, multiplication, absolute difference, ratio (must be greater than equal to 1). Your class must be called TwoNumberArithmetic. Your program file must be named TwoNumberArithmetic.java. Your output should match the one given by the Sample class: SampleTwoNumberArithmetic.class

Your header will, of course, use your name and student ID.
Zip and submit all the Java files and class files used in this assignment.


Assignment #3:

Programming project 9 from Chapter 2 of the Savitch book. Your class must be called SillySentence. Your program file must be named SillySentence.java. Your output should match the one given by the Sample class: SampleSillySentence.class

Your header will, of course, use your name and student ID.
Zip and submit all the Java files and class files used in this assignment.


Assignment #4:

Write a program that accepts two numbers, and operation as input and outputs their addition, multiplication, absolute difference, ratio (must be greater than equal to 1). The operation can be input as a string such as: plus/add/sum, subtract/minus/difference, ratio/divide, product/multiply. Your class must be called TwoNumberCalculator. Your program file must be named TwoNumberCalculator.java. Your output should match the one given by the Sample class: SampleTwoNumberCalculator.class

Your header will, of course, use your name and student ID.
Zip and submit all the Java files and class files used in this assignment.


Assignment #5:

Programming project 3 from Chapter 4 of the Savitch book. Your class must be called TemperatureConverter. Your program file must be named TemperatureConverter.java. Your output should match the one given by the Sample class: SampleTemperatureConverter.class Note the program should continue until the user enters a 'Q' or 'q' as indicated by the sample program.

Your header will, of course, use your name and student ID.
Zip and submit all the Java files and class files used in this assignment.


Assignment #6:

Programming project 13 from Chapter 4 of the Savitch book with one enhancement: use the last digit of the number that was entered for number of rows. For example, if the number of rows is 12, use '2' to draw the triangle. Please see the sample program for a demo. Your class must be called TriangleOfDigits. Your program file must be named TriangleOfDigits.java. Your output should match the one given by the Sample class: SampleTriangleOfDigits.class

Your header will, of course, use your name and student ID.
Zip and submit all the Java files and class files used in this assignment.


Assignment #7:

Write a class called Prime, which has two methods:

 public static void DisplayHeader()
 public static boolean isPrime(int number)

The function returns a true if number is a prime, false otherwise. A prime number is only divisible by itself and one. Number 1 is not a prime number. Your program should work with the PrimeTest.java file supplied here. You can look at the sample output using the following class file:
Prime.class

Your header will, of course, use your name and student ID.
Zip and submit all the Java files and class files used in this assignment.


Assignment #8:

Programming project 1 from Chapter 7 of the Savitch book. Your class must be called PercentOfSum. Your program file must be named PercentOfSum.java. Your output should match the one given by the Sample class: SamplePercentOfSum.class

Your header will, of course, use your name and student ID.
Zip and submit all the Java files and class files used in this assignment.