My sophomore Computer Science 2 class.
Input Output without Scanner 09/15/15
INPUT OUTPUT WITHOUT SCANNER: Without using the Scanner class, examine the Java API and write a program that takes in a Players Name as well as their 3 Golf Scores, then determine and display (without using System.out.println) their AVERAGE Score.
Over Eighteen With JOption Pane 09/17/2015
OVER EIGHTEEN WITH JOPTION PANE: You can use JoptionPane or Scanner to do the following: Read in a person's FIRST NAME , BIRTHDAY(MONTH AND YEAR). Then using the current Month and Year determine if the person is OVER 18 years old. Display a result. Example:
Input: SallyJoeBob 09 2000
Output: SallyJoeBob, you are NOT over 18 years old.
String Examination 09/21/15
STRING EXAMINATION: Read in a String and determine the following: TOTAL number of letters, If it starts with a Vowel, Total number of numbers in the string. Example:
Input: Apple123
Output: 8 letters, YES, 3
ExactAgeCalc 09/24/15
EXACT AGE CALC: Accept a month day and year of birth. Get the current date and determine a persons full age as in YEARS plus days old. Example:
Date: 9-27-2015
Input: 9-26-2000
Output: 14 years and 364 days old
Library Fine 09/29/15
LIBRARY FINE: Write a Java Application that reads in a persons full name (First Middle and Last) along with the fines they owe on 10 books. The fines range from no fine .0 to a fine of 10.95Ask the user for the information and then calculate the TOTAL fine they oweDisplay their FULL NAME along with their TOTAL FINE. YOU MUST Write code to process this information using ALL ofThe I/O methods we discussed: JOptionPane ScannerAlso Display the Largest Fine and the Smallest Fine. Example:
Please Enter Your First Name: David
Please Enter Your Middle Name: John
Please Enter Your Last Name: Farrell
Enter the Fine for the First Book: .10
Enter the Fine for the Second Book: 1.10
Enter the Fine for the Third Book: 3.10
Enter the Fine for the Fourth Book: 8.10
Enter the Fine for the Fifth Book: .0
Enter the Fine for the Sixth Book: .70
Enter the Fine for the Seventh Book: .90
Enter the Fine for the Eighth Book: .05
Enter the Fine for the Ninth Book: .10
Enter the Fine for the Tenth Book: .10
David John Farrell, Your total fine is: $14.25
Character Application 09/30/15
CHARACTER APPLICATION: Write a Java application that reads in FIVE characters and displays them Combined along with their total ASCII valueAlso display on a separate line the last character entered along with its ASCII Value. Example:
A B c F Y has a value of 332
Y has an ACSII value of 89
Running Speed Capacity 10/02/15
RUNNING SPEED CAPACITY: Using what we learned yesterday, Write a function called RunSpeedCapacity. This function should take in arguments that you could use to calculate and RETURN a person's maximum speed. For example, you can pass in a persons weight height stride and age to MAKE YOUR own formula to determine that persons running speed. GET all the required data from SPVM and then CALL your function and display the result it gives you. The formula does not have to be perfect, so you can have a little fun with your calculations. For example: if someone is 72 inches tall, 180 pounds and has a stride of 34 inches and is 22 years old, my calculation would be that person can run at a top speed of 14 miles per gour.
Running Speed Capacity v2 10/05/15
RUNNING SPEED CAPACITY v2: Use Your RunSpeed function to generate speeds for 5 people. Ask for the data for each person and then Determine and DIsplay The people by order of their respective Speed. THEN ADD A RACE FUNCTION that uses randomness and a persons speed to determine who would win a race by using the randomness as a mitigating factor (injury, etc). DIsplay the winners of each "RACE"
Date Functions 10/07/15
DATE FUNCTIONS: Create several functions that calculate dates in various ways. FIRST write a DateConvert Function that takes in a month, day and year and calculates the JULIAN DATE (YYYYDDD). Then write a function Datefrom Julian that TAKES in a julian date (YYYYDDD) and returns the date in MM DD YYYY format. FInally write a DAYS BETWEEN method that takes in 2 dates and returns the NUMBER OF DAYS THAT EXIST BETWEEN THESE TWO DATES
Math Functions 10/09/15
MATH FUNCTIONS: Write a function that accepts 2 numbers and an operation and then applys that operation and returns the answer. Example:
Input: 4, 5, +
Output: 9
Rectangle Function 10/13/15
RECTANGLE FUNCTION: Read the attached document and then write 2 new functions that 1- determines if a point lies in the boundary of a rectangle and 2- determine if the rectangle is parallel to the x-axis
Point Class 10/14/15
POINT CLASS: Write a class called Point. Point has 2 attributes x and y. Allow for a constructor and sets and gets
Alarm Clock 10/19/15
ALARM CLOCK: alarm clock class with properties: wake up time, boolen, current time, sound and methods: select sound, check for alarm, play alarm, set time
Dynamic Point // file is missing 10/21/15
DYNAMIC POINT: Using your POINT class, WRite a class called DynamicPoints. This class uses your Point class, The class accepts in 2 Points that define a VERTICAL LINE SEGMENT. THEN, create a LINE that emanates from (0,0) by RANDOMLY generating a SLOPE for that line. FInally, allow the class to determine if the generated LINE PASSES THRU the Vertical Line SEgment.
Apartment 11/02/15
APARTMENT: PRAC: Build an Apartment class with Attributes for Maintaining info apartments like rooms, floor, rent, num rooms, num occupants, central air and the respective sets & gets. RESTRICTIONS: rooms must be between 1 and 5, occupants between 1 and 10. Add Sets & Gets to the class and use them PLUS. A calc monthly rent method: Rent = num occ * num rooms * 100 +/- A/C (200 plus w/ -100 w/out). Allow for THREE OVERLOADED constructorsSPVM to run it and show your constructors and methods work as intended.
Circle 11/09/15
CIRCLE: Write a Circle Class that has state for RADIUS, AREA, DIAMETER, NAME and Circumference . Allow the class to CONSTRUCT with either the radius, diameter OR circumference. YOU MUST THEN DERIVE the remaining 2 values. Have a CALCULATE AREA method and sets for the area, diameter and circumference. IF YOU change any of those, the remaining values MUST be recalculated.
Circle Array 11/10/15
CIRCLE ARRAY: Create an Array of your Circle class, 100, circles. Make sure all circles have a radius, etc. Then, in SPVM, ask for a number then display the number of Circles that have a Radius GREATER than or EQUAL to the stated number.
Dice Roll 10/16/15
DICE ROLL: As we discussed in class, create a program that simulates X number of dice rolls (2 die added). Display the frequency distribution. THEN display the distribution IN ORDER OF THEIR FREQUENCY.
Arithmetic Expressions 10/18/15
ARITHMETIC EXPRESSIONS: See attached .pdf
PHYSICS PROJECT: In physics, there are four linear motion formulas. These formulas all involve four of the following five variables: original velocity (v0), final velocity (vf), acceleration (a), distance (d), and time (t). The four formulas are listed below.
- d = .5*(v0 + vf)*t
- a = (vf-v0)/t
- d = v0t + .5a*t2
- d = (vf2-v02)/(2*a)
The program must prompt for all five variables. The user will then enter numbers for three of the variables and question marks ("?") for the other two variables. If the user enters too many or too few question marks, the program must ask the user to reenter. Once the user has entered the values, the program must determine which formulas to use and derive the answers for the two unknown variables. Example:
Enter original velocity: 0 Enter final velocity: 100 Enter distance: ?
Enter time: ?
Enter acceleration: 9.8
distance = 510.204 time = 10.204
Do you want to do another calculation (y or n): y
Enter original velocity: 0 Enter final velocity: 100 Enter distance: ?
Enter time: ?
Enter acceleration: ?
INCORRECT INPUT! Please reenter
Enter original velocity: 0 Enter final velocity: 100 Enter distance: ?
Enter time: ?
Enter acceleration: 9.8
distance = 510.204 time = 10.204
Do you want to do another calculation (y or n): n
Conditional Expressions Projects
CONDITIONAL EXPRESSION PROJECTS: See attached .pdf
Holiday Class (c) Jon Moss @maclover7
HOLIDAY CLASS: THIS CLASS NEEDS TO SERVE AS A SET OF UTILITY METHODS THAT ASSIST YOU IN DETERMINING ON WHICH DATES VARIOUS HOLIDAYS FALL.
STORE FRONT: Write a “store” Class with a default and overloaded constructor. Attributes -- Location, Items[3], Owner, Phome number. Default and Overloaded Constructor with Sets and Gets. With array of items too.
STORE: Use the previous Store, Inventory, and Item classes to create a full store with a SPVM.
GOLF SCORES: DISPLAY the HIGHEST SCORE, LOWEST SCORE, AVERAGE SCORE and the TOTAL OVER or UNDER PAR of three golf scores.
FAST FOOD v2: Modify Fast Food to allow multiple customers to be processed during one run of your program. Report the day's statistics at the end of the day.
Iterative Structures Projects:
- Reciprocal Squares
- Factorial
- Add Cubes
Text Analysis 06/13/16
TEXT ANALYSIS: Write a program that allows the user to type in several lines of text (use a sentinel to know when the user is done). Read in the data and perform the following: Determine the number of occurrences of each letter in the alphabet in the text. Determine the number of one-letter words, two-letter words, three-letter words, etc… Determine how many lines of text and how many words were entered.
GREP 06/08/16
GREP:
StringsWrite a simplified GREP program (GREP is a UNIX utility that scans a file or several files for a given word and prints out all lines in which that word occurs) that looks for a word in 1 file. A word is defined as a contiguous string of alphanumeric characters. For each line in which the word is contained, display the line number and the line: For example, theuser tells you to look in file army.txt to find the word “army” results in Line 25: You are in the army now.
Find Names 06/10/16
FIND NAMES: Write a program that finds names in a file that start with a (user specified) specified character. Create a file that contains people’s names: Joe Mary Jennifer Danny Etc...
Ask the user for the character to use in the search and roll thru the names in the file and display all names starting with the given character. At the end, display the number of names that matched and ask the user if they want to perform another search. Create a sentinel value to end the program (upon user request). Example:
Enter a letter to search names: J
The following names matched the search for J:
Joe
Jennifer
There were 2 matches
Encode/Decode 06/11/16
ENCODE/DECODE: Write a program that will take in a word from a user. Redisplay the nuser to conform the word they entered and ask them if they want to ENCODE or DECODE the word. Allow the word to contain letters and/or numbers.Define string variables to serve as and index key and a code key. If the user requested to encode the word, use the key string variables to uniformly convert the word to a coded word and display it to the user. If the user requested to decode the word, use the key string variables to uniformly convert the word to from its coded state and display it to the user. SAMPLE:
Enter a message in all caps: HELLO
You just typed in HELLO
Enter E to encode, D to decode:
E
Your message has been encoded as:
36ZZW
CountWords 06/15/16
COUNT WORDS: Write a program that takes in a file from a user and prints out:the number of words in the file the total number of characters in the filethe longest word in the filethe average length of the words in the file. Allows the user to input a word and the program displays if the word is in the file and, if so, how many times it occurs. EXAMPLE:
Please enter the name of the file to check:
myfile.txt
There were 121 words in the file
There were 634 characters in the file
The longest word in the file is mississippi
The average length of a word in the file is 7
Please Enter a Word to Search For:
the
The word the appears 62 times in the file.
All code in this repository is owned by and has the copyright of Tejas Gupta.