Answer:
- import java.util.Scanner;
-
- public class Main {
- public static void main (String [] args) {
-
- int jersey_num [] = new int[5];
- int rating [] = new int[5];
-
- Scanner inStream = new Scanner(System.in);
-
- for(int i=0; i < 5; i++){
- System.out.print("Enter player " + (i+1) + "'s jersey number:");
- jersey_num[i] = inStream.nextInt();
-
- System.out.print("Enter player " + (i+1) + "'s rating:");
- rating[i] = inStream.nextInt();
- }
-
- System.out.println("ROSTER");
-
- for(int j=0; j < 5; j++){
- System.out.println("Player " + (j+1) + "-- Jersey number: " + jersey_num[j] + ", Rating: " + rating[j]);
- }
- }
- }
Explanation:
The solution code is written in Java. Firstly create two array, jersey_num and rating, with int type. This is to hold the five pairs of numbers input by user (Line 6 -7).
Next, create a for loop that run for 5 iterations and in each iteration prompt user to input jersey number and rating (Line 11 -17). The input number and rating will be set to the array, jersey_num and rating, respectively.
Next, print the title "Roster" (Line 19).
Create another for loop to display the five input pair of values (Line 21 - 23).
bruuh, wht is this man saying
Hi!
Well, this isn't exactly a question - but rather just a request. However, I'm going to attempt to try and <em>describe </em>to you how to approach this problem, instead of just writing the code for you and sending you on your way.
So, what's our general base goal here? We want to take a string into a function, and then print it out backwards. Seems simple enough!
Right away, we already have an idea how to set this code up. We need a main method which will call <em>PrintBackwards(), </em>which will have to take a parameter of type string.
This would look something like <em>PrintBackwards(string baseString). </em>Inside this method, we'd have to do something so we can see each character in this string and then store it in a new string.
I encourage you to try and tackle this on your own, but I can give you an idea. We can have a new valueless variable called reversedString, which will store our baseString but backwards.
We could try looping through the baseString for each character it possesses, and then keep adding onto our reversedString by doing something like +=. What I mean, is we'd access the very last index of baseString, and then keep appending characters into it.
So our loop would look something like <em>for(int i = baseString.length; i > 0; i--) {}.
</em>I haven't used C++ in awhile, so you'll have to find the specific syntax requirements. But with that loop, i represents the index of each character in baseString. It starts with the last index, and keeps going down in reverse.
<em>
</em>Inside our loop, we could do something like reverseString += baseString.index(i); Again, I don't remember the specific syntax - so you'll have to do this on your own.
<em>
</em>Hopefully, this helps! =)<em>
</em>
E. Purchase the domain name first.
The top-level folder (root directory).