Bootstrap
Presentations: https://mrmonline.org/bootstrap-presentation/
Bootstrap Themes : https://bootswatch.com/4/
Bootstrap
Presentations: https://mrmonline.org/bootstrap-presentation/
Bootstrap Themes : https://bootswatch.com/4/
Employ the rules/conventions below. -1 point for violating these standards
^^image from https://khalilstemmler.com/blogs/camel-case-snake-case-pascal-case/
These examples relate to the ClassRoster assignment
Instance variables should be declared private at the top and should be initialized in the constructor.
A Note on plagiarism
If you hand in work that you can not explain, it is considered plagiarism. Let’s not go there please. Remember- we follows Syracuse’s academic guidelines . If you use someone else’s work for a portion of the assignment, you will get a zero for the entire assignment. Additionally, if a person in the class gives you the code, that other person also gets a zero.
A PlayList project will be based on 3 Classes
The Artist class will store core information about an artist.
The Song class will store basic information about a song.
The PlayList class will manage a list of artists and their ratings.
Example of instantiating an Artist object and calling one of its methods:
1 2 3 |
Artist redHotChilliPeppers = new Artist("Red Hot Chili Peppers") ; redHotChilliPeppers.addSong( new Song("Snow") ); ArrayList<Song> chiliSongs =redHotChilliPeppers.getSongs() ; |
Example of instantiating a Song object :
1 2 |
Artist redHotChilliPeppers = new Artist("Red Hot Chili Peppers") ; Song underBridge = new Song (redHotChilliPeppers , "Under the Bridge") ; |
Before you do the PlayList class, run the Artist/ Song tester (see top ^^)
Read this to make sure you’re doing variables correctly.
Mutator Methods
The 2 method’s below are extra credit. If you figure out how to do them, you must also meet with me after school about the methods. To receive the extra credit, be prepared for a mini-quiz on how they work . You will need to do some research to figure out how to do them. Be prepared for me to ask about your solution and how changing certain parts of your code would affect your solution.
When you’re done this, begin exploring different sorting algorithms with this online sorting detective :
https://labs.penjee.com/sort-detective/
How to access each digit in an int in Java
1 2 3 4 5 6 7 |
int n ; // some integer while ( n > 0){ int digit = n % 10 ; //ones place digit print(digit) ; n = n / 10 ; // now the ones place by int division } |
ArrayFun3 - Please call your class that , exactly. Yes, you will lose a point for not following this simple specification.
int[] removeZeroes(int [] nums)
Description: This method returns a version of nums in which all occurrences of 0 , zero, are removed
Method Call | return value/output |
noZeroes( { 3 , 4, 0, 1} ) | { 3, 4, 1} |
noZeroes( { 0, 5 , 0, 0, 9, 0, 1 , 11} ) | { 5,9,1,11} |
String[] removeNulls(String[] strs)
Description: This method returns a version of strsin which all null values are removed. Note:
int[] digitsToArray(int n)
@precondition n > 9
Description: This method takes each digit in the integer n and stores it in an array in reverse order, as shown below. First, make sure you understand the code here. , which btw, testers had to figure out , on the fly, in a previous AP A test.
int[] removeLeadingZeroes(int[] nums)
@precondition nums.length >=2
Description: This method returns an array in which all elements that meet the 2 criteria below are removed.
int[] doubleUp( int [] nums, int val)
@precondition nums.length >=2
Description: This method returns a version of nums –with all occurrences of val duplicated.
Method Call | return value/output |
doubleUp( { 3 , 4, 0, 1} , 4 ) | { 3, 4 , 4, 0, 1} |
doubleUp( { 1, 3 , 1, 5 , 3, 3} , 3 ) | {1 , 3, 3 , 1, 5 , 3, 3, 3, 3 } |
Similar problems on codingbat
In addition to the required Unit 2 Creative Task, if you want some extra credit, you can do the following assignment:
Research how groups work in CMU ( see the docs)
Write a program that
You can write this in one of empty creative a tasks.
For this creative task,
This is a 10 Point assignment:
To get 9 points:
To get the 10th point,
Research how groups work in CMU ( see the docs),