package assignment2.Q9;
/*
* Assignment2, COMP268 Class: Robot.java Purpose: Robot object with x and y
* does data manipulation to find continues points for players 1 and 2
*
* @author: Rogers Abraham Student ID: 3273409 Date: December 29th, 2016 Version
package assignment2.Q3;
/*
* Assignment2, COMP268 Class: CreditCard.java Purpose: Run an credit card
validation algorithm
* @author: Roger Abraham Student ID: 3273409 Date: December 29 2016 Version 1.0
*
*
Based on: McMillan, Mike. (2011). Learning to pro
package assignment2.Q2;
import java.util.Random;
/*
* Assignment2, COMP268 Class: RockPaperScissorsLizardSpock.java Purpose: A 5
opition verison of rock paper sissors
* @author: Roger Abraham Student ID: 3273409 Date: December 29 2016 Version 1.0
*
*
Base
package assignment2.Q5;
/*
* Assignment2, COMP268 Class: Citizen.java Purpose: C citizen with lots of
fields
* @author: Roger Abraham Student ID: 3273409 Date: December 29 2016 Version 1.0
*
*
Based on: McMillan, Mike. (2011). Learning to program with Jav
package assignment2.Q7;
/*
* Assignment2, COMP268 Class: Person.java Purpose: Calculates peoples BMI's
*
* @author: Rogers Abraham Student ID: 3273409 Date: December 29th, 2016 Version
1.0
*
*
Based on: McMillan, Mike. (2011). Learning to program with Jav
package assignment2.Q8;
/*
* Assignment2, COMP268 Class: BadmintonScoringWithStrokes.java Purpose: Stores
scores and does data manipulation to find continues points for players 1
* and 2
*
* @author: Rogers Abraham Student ID: 3273409 Date: December 29th,
package assignment2.Q1;
/*
* Assignment2, COMP268 Class: ReversedSentence.java Purpose: String
manipulation on user entered input strings
*
* @author: Roger Abraham Student ID: 3273409 Date: December 29 2016 Version 1.0
*
*
Based on: McMillan, Mike. (2011
package assignment2.Q5;
/*
* Assignment2, COMP268 Class: RandomSumGame.java Purpose: a villlage holds
citizens
* @author: Roger Abraham Student ID: 3273409 Date: December 29 2016 Version 1.0
*
*
Based on: McMillan, Mike. (2011). Learning to program with J
package assignment2.Q8;
/*
* Assignment2, COMP268 Class: BadmontonScoring.java Purpose: Stores scores and
* does data manipulation to find continues points for players 1 and 2
*
* @author: Rogers Abraham Student ID: 3273409 Date: December 29th, 2016 Versi
package assignment2.Q8;
/*
* Assignment2, COMP268 Class: point.java Purpose: defines a point object
*
* @author: Rogers Abraham Student ID: 3273409 Date: December 29th, 2016 Version
*
1.0
*
*
Based on: McMillan, Mike. (2011). Learning to program with Java
package assignment2.Q5;
/*
* Assignment2, COMP268 Class: COmputeIntellecty.java Purpose: Computes teh
qulifications of a citizen
* @author: Roger Abraham Student ID: 3273409 Date: December 29 2016 Version 1.0
*
*
Based on: McMillan, Mike. (2011). Learning
package assignment2.Q4;
/*
* Assignment2, COMP268 Class: RandomSumGame.java Purpose: Plays a game of craps
* @author: Roger Abraham Student ID: 3273409 Date: December 29 2016 Version 1.0
*
*
Based on: McMillan, Mike. (2011). Learning to program with Java:
When is O(n2) considered a costly algorithm? Is there a less costly alternative?
collision detection is very costly because, fundamentally, every object should be tested against every other object for a possible collision, which is O(n2) time complexity
package ass1;
import java.util.ArrayList;
import java.util.Scanner;
public class HailstoneSequence cfw_
public static void main(String Args[]) cfw_
Scanner sn = new Scanner(System.in);
System.out.println("Enter A beggining Value: " + "\n");
int value = sn
Chapter 9 Challenge Question 1
Included as JAVA file.
Chapter 10 Excercise 1
What is the output from the following section of FORTRAN code?
ISUM = 0
I= 1
20 IF (I .GT. 4) GO TO 30
ISUM = ISUM + I
I =I+1
GO TO 20
30 WRITE(*,*) ISUM
A: Loop 1: IS
package ass1;
import java.util.Random;
/*
*
* @author Rogers
* @date 11/23/2016
* @Program Task: program that randomly generates monthly savings amounts for
*
the 15 runners in Problem 4. Each monthly saving should be in the
*
range of $100 to $800. Exten
Chapter 4. Question 19.
Assume that a = 1,b = 2,and c = 2.
What is the value of each of the following Boolean expressions?
a. (a > 1) OR (b = c)
b. [(a + b) > c] AND (b c)
c. NOT(a=1)
d. NOT [(a = b) OR (b = c)]
e. (a = 1) AND (b = 1) AND (c = 2)
A.
package ass1;
/*
*
* @author Rogers
* @date 11/23/2016
* @Program Task: Addressbook class with various fields, getters and setters
*
related to an address book.
*/
public class AddressBook cfw_
private
private
private
private
private
private
private
priva
Assignment 3
CHAPTER 6 CHALLENGE QUESTION 1
Write an assembly language program to sum up a list of 50 numbers that
are read in and stored in memory.
Here is the algorithm you are to translate:
Read in 50 numbers A1, A 2,., A50
Set Sum to 0
Set i to 1
Chapter 17 Excercise 1
Practice creating analogiesPick three topics from the list shown here,
or make up some topics of your own that involve technology and humans.
For each topic, think of an analogous situation that does not involve computing.
Make a s
Chapter 13 Question 5
How do you think it is possible for a computer to generate a truly random number
that successfully passes all tests for randomness? Read about random number generators
and discuss the algorithms that they use.
A: There are two types
package ass1;
import java.util.Scanner;
/*
*
* @author Rogers
* @date 11/23/2016
* @Program Task: program that prompts the user to enter two points (x1, y1) and
*
(x2, y2). Calculate and display the distance between the two points
*/
public class Cartesia
package ass1;
/*
*
* @author Rogers
* @date 11/23/2016
* @Program Task: quarterly and annual bonus to its employees only if the
*
savings of the quarter and/or the year are greater than or equal to
*
quarterly minimum (monthly commitment x 3) and/or the a
package ass1;
/*
*
* @author Rogers
* @date 11/23/2016
* @Program Task: Allows you to create marathon runners with time and years and
*
addressbook fields too. you can calculate average running times who
*
came in first place and second place as well as f
package q5;
/*
* Task: Create a subclass of BinaryTree whose nodes have fields for storing
preorder, post-order, and in-order numbers. Write methods preOrderNumber(),
inOrderNumber(), and postOrderNumbers() that assign these numbers correctly.
These
metho
package q1;
public class BinaryTree cfw_
public static Node root;
public void addNode(int key, String name) cfw_
/ Create a new Node and initialize it
Node newNode = new Node(key, name);
/ If there is no root this becomes root
if (root = null) cfw_
root =
package q4;
/*
* @Task: Implement a commonly used hash table in a program that handles
collision using linear
* probing. Using (K mod 13) as the hash function, store the following elements
in the table: cfw_1, 5, 21,
* 26, 39, 14, 15, 16, 17, 18, 19, 20,