forked from auberonedu/derusting
-
Notifications
You must be signed in to change notification settings - Fork 25
Java Derusting #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Ebtisam0402
wants to merge
35
commits into
grc-cohort-22:main
Choose a base branch
from
Ebtisam0402:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Java Derusting #18
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
c447125
created an array name my array that hold 4 strings
Ebtisam0402 c0cd688
set the five value with their index
Ebtisam0402 a035beb
run code get highline
Ebtisam0402 a2ad92e
the length of an array 4
Ebtisam0402 52b391e
accessed each element using for loop
Ebtisam0402 6c3db9b
used for each loop to get each element
Ebtisam0402 e945579
first I imported java .util.list.Then I created an empty arratlist of…
Ebtisam0402 c162cd8
I used the set method and replace index 1 with out changing the ength…
Ebtisam0402 4bc80fb
Created a new element and used the add method and the length has been…
Ebtisam0402 0e4fbc7
I used list.contains to check a if it contains certain string (manar)…
Ebtisam0402 1758a20
for-loop created and the index and value in newline.
Ebtisam0402 83acb7c
the last two steps I sorted the elements using collections.sorrt. and…
Ebtisam0402 1d16803
created hashMap called people.
Ebtisam0402 322ec7c
used put method to add three people key and value
Ebtisam0402 6ef387c
for loop to get the value associated with the key in the map
Ebtisam0402 2f34ac4
used size()method
Ebtisam0402 4d0409d
using the replace and by specifing which string to be change using ke…
Ebtisam0402 374e7d8
cheched if each key and value have the element by using the method co…
Ebtisam0402 147343a
used map.keyset() method returns the key and map.values returns the v…
Ebtisam0402 8fe6544
loo over the keys and searching for the value
Ebtisam0402 52c24ea
float is a fraction number or decimal. integer is a whole number. mod…
Ebtisam0402 7acae54
get the even or odd by using modulo operation when divid 8 by 2 the r…
Ebtisam0402 0c55e75
divide two integers and the result will be rounded or the remaider is…
Ebtisam0402 e0f331a
from the person class declare as a public string (name) and private i…
Ebtisam0402 5015cf4
created a Hashset object called shools. Then I added each element usi…
Ebtisam0402 e2dd077
using the contains method , I checked if school name or string is their
Ebtisam0402 bd834a1
used the remove method and for the size, I used size method (shcool.s…
Ebtisam0402 565dbbf
used for loop to print it in each line.
Ebtisam0402 8eaaff0
variable name massage I created string with characters.
Ebtisam0402 0f8c8f9
found the length of the string which struggle coding
Ebtisam0402 58e9940
created two strings and then add them or used an addition sign.
Ebtisam0402 25b5702
this string has two p's so it gave me the the first p at index 2. I d…
Ebtisam0402 0f8c874
used contains method
Ebtisam0402 7f5b09a
I couldn't solve the iterate over the character
Ebtisam0402 00fee17
created array list of string with an empty list. then added two strings
Ebtisam0402 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,36 @@ | ||
| public class ArrayPractice { | ||
| public static void main(String[] args) { | ||
| // Create an array of Strings of size 4 | ||
|
|
||
| String[]myArray; | ||
| myArray = new String[4]; | ||
| // Set the value of the array at each index to be a different String | ||
| // It's OK to do this one-by-one | ||
|
|
||
| myArray[0] = "Green River"; | ||
| myArray[1] = "Seattle Central"; | ||
| myArray[2] = "Highline"; | ||
| myArray[3] = "South Seattle"; | ||
|
|
||
| // Get the value of the array at index 2 | ||
| System.out.println(myArray[2]); | ||
|
|
||
| // Get the length of the array | ||
| System.out.println(myArray.length); | ||
|
|
||
| // Iterate over the array using a traditional for loop and print out each item | ||
|
|
||
| for (int i =0; i<myArray.length; i++){ | ||
| System.out.println("Element at index " + i + ": " +myArray[i]); | ||
| } | ||
| // Iterate over the array using a for-each loop and print out each item | ||
|
|
||
| for (String myArray1 : myArray ){ | ||
| System.out.println(myArray1); | ||
| } | ||
|
|
||
| } | ||
| /* | ||
| * Reminder! | ||
| * | ||
| * Arrays start at index 0 | ||
| */ | ||
| } | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this file is incomplete. I strongly recommend going back and doing it! Feel free to come by office hours or tutoring for help.