Final tasks

New Java Syntax
Level 13 , Lesson 7
Available

"Hello, soldier!"

"Hello, Captain Squirrels, sir!"

"Here are some exercises to level-up your skills and solidify knowledge."

13
Task
New Java Syntax, level 13, lesson 7
Locked
Cat code won't compile
Task: The program reads data about cats from the keyboard and displays it on the screen. For example: Cat's name: Tiger, age: 6, weight: 5, tail: 22 Cat's name: Missy, age: 8, weight: 7, tail: 20
13
Task
New Java Syntax, level 13, lesson 7
Locked
Display numbers in reverse order
Enter 10 numbers from the keyboard and put them in a list. Display them in reverse order. Each element on a new line. Use only a for loop.
13
Task
New Java Syntax, level 13, lesson 7
Locked
Shuffled just in time
Use the keyboard to enter 2 numbers N and M. Enter N strings and put them in a list. Move the first M strings to the end of the list. Display the list, each value on a new line. Note: - all numbers and strings must be entered from the keyboard with a new line; - you must not create more than one li
13
Task
New Java Syntax, level 13, lesson 7
Locked
You need to replace the program's functionality
Currently, the program reads lines from the keyboard until you enter an empty string. All the entered strings are converted to uppercase and displayed on the screen. For example, if the string "Mom" is entered, followed by an empty string, then "MOM" should be displayed. The modified program should
13
Task
New Java Syntax, level 13, lesson 7
Locked
The end
Create a list of strings. Enter strings from the keyboard and add them to the list. Enter strings from the keyboard until the user enters "end". The string "end" is ignored. Display the strings on the screen, each on a new line.
13
Task
New Java Syntax, level 13, lesson 7
Locked
Maximum and minimum numbers in an array
Create an array of 20 numbers. Populate it with numbers from the keyboard. Find the maximum and minimum numbers in the array. Display the maximum and minimum numbers, separated by a space.
13
Task
New Java Syntax, level 13, lesson 7
Locked
Family census
Create the Human class with String name, boolean sex, int age, Human father, and Human mother fields. Create and populate objects so that we end up with: Two grandfathers, two grandmothers, one father, one mother, and three children. Display the objects on the screen. Note: If you write your own Str
13
Task
New Java Syntax, level 13, lesson 7
Locked
In decreasing order
Task: Write a program that reads 20 numbers from the keyboard and displays them in decreasing order.
Comments (53)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
LaikaLaikaka Level 32, United States of America, United States
21 March 2025
For the you need to replace the program functionality exercise, do we count space and non letter character when calculating number of character? If we do, shouldn't "forty one" be odd? If we don't, shouldn't "j r" be even?
Anonymous #10782038 Level 24, United States of America
19 March 2024
max and min has a validator issue. I was getting the correct output but I set max = Integer.MIN_VALUE and in their solution they just set both to the first element of the array. My solution worked but their validator didnt like it for some reason.
Anonymous #10960894 Level 19, Arnold, United Kingdom
29 March 2022
in the maximum and minimum numbers task, there's no reason not to determine the max and min in the same loop in which they are entered, yet the validator doesn't like it :/
Spydrow Level 14, Germany, Germany
4 May 2022
I had the same problem
Pat Level 19, Czech Republic
7 December 2022
it was fixed, I used just single loop and it worked.
Jakub Wasilczyk Level 19, Warsaw, Poland
8 September 2021
shuffled just in time, im here so far: father mother son daughter cat dog program car father mother son daughter when i :

for (int i = 0; i<m; i++){
            list.remove(i);
        }
it removes every 2nd line, why?: mother daughter dog car father mother son daughter
Jakub Wasilczyk Level 19, Warsaw, Poland
8 September 2021
nvm, got it:

for (int i = 0; i<m; i++){
            list.remove(0);
        }
Ewa Borysiewicz Level 9, Ramsgate, United Kingdom
12 January 2022
I've had the same problem, that's because if you remove an item at index 0 then all the other items get shuffled to the left, so the item that was previously at index 1 is moved to index 0 etc. I bypassed it by iterating back to front, then removing items from index i of i was smaller than m :)
Justin Smith Level 41, Greenfield, USA, United States
11 July 2021
"Be sure that you just display the array in reverse order. You don't need to reverse the order of the elements in the list." I don't understand this bit. How do you display an array (or arraylist) in reverse order without reversing the order of the elements? That sounds a bit like saying "paint the house red, but you don't need to paint the house red."
Justin Smith Level 41, Greenfield, USA, United States
11 July 2021
Just checked if they mean the counting order of the numbers entered, no they do not mean that. I have no idea what this task wants me to do.
Banana Llama Level 8
27 July 2021
Think about how you are looping through arrays currently. Usually from start to finish. But you can also loop through the other way around by adjusting the for loop variable.
P.B.Kalyan Krishna Level 22, Guntur, India
27 April 2023
That just means displaying the elements from the last. That is the last element in the array is displayed first followed by the second last element and so on. You just need to loop through the array in reverse order. Consider this:- int [] arr = {1,2,3,4,5}; for(int i = arr.length - 1; i >=0; i--) System.out.print(arr[i]); This prints 5,4,3,2,1.
DarthGizka Level 24, Wittenberg, Germany
29 May 2021
task0719 (Display numbers in reverse order) caveat: you will get failed if you use anything other than an ArrayList<Integer>, even though that requirement is not stated anywhere and this is not really an appropriate structure for the job.
Anonymous #10782038 Level 24, United States of America
19 March 2024
It is clearly stated to use an Integer list.
Sunaina Yadav Level 13, Ahmedabad, India
27 January 2021
Cat code won't compile exercise gives java.lang.NullPointerException even when I download the correct solution and it passes testing. I tried while(true){ String name = reader.readLine(); int age= Integer.parseInt(reader.readLine(); int weight=Integer.parseInt(reader.readLine(); int tailLength=Integer.parseInt(reader.readLine(); then pass these values to the constructor. But it keeps giving me NumberFormatException Don't know what is wrong with this but got an answer that I am trying to convert null to int.
Mihai Bone Level 8, Bucharest, Romania
14 December 2020
Family census: Tips - Don't try like me to recreate their output ...... just display 4 objects with 3 parameter and 5 objects with 5 parameter
Brad Reed Level 19, Hartford, United States
2 July 2020
raise your hand if you've been victimized by predictive text... I know I have LOL
Mayu Level 25, Toronto, Canada
3 June 2020
When it says the solution to the task is better than X% other students, what's the metric being used. Is it complexity or efficiency?
Oliver Heintz Level 18, Mustang, United States
16 June 2020
I'm fairly certain all they're reporting is number of attempts.