Groupings
by CodeChum Admin
Did you know that you can also reverse lists and group them according to your liking with proper code? Let's try it to believe it.
Instructions:
Create a variable that accepts a positive odd integer.
Create an empty list. Then, using loops, add random integer values into the list one by one. The number of values to be stored is dependent on the inputted odd integer on the first instruction.
Reverse the order of the list. Then, print out the list's new order in this manner:
[first-half values]-[middle value]-[second-half values], just like that of the sample output. Make use of list slicing that you’ve learned from the past lessons to easily achieve this segment.
Input
The first line contains an odd positive integer.
The next lines contains an integer.
5
1
3
4
5
2
Output
A line containing a list.
[2,5]-[4]-[3,1]
The GCD
by CodeChum Admin
The greatest common divisor, also known as GCD, is the greatest number that will, without a remainder, fully divide a pair of integers.
Now, I want you to make a program that will accept two integers and with the use of loops, print out their GCD. Make good use of conditional statements as well.
Off you go!
Input
A line containing two integers separated by a space.
6·9
Output
A line containing an integer.
3
Arraying 102
by CodeChum Admin
We've already made arraying/listing the easy way, but how about arraying/listing and printing the list in reverse order?
Make a program that will input an integer and then using loops, add items on an array/list one by one for the same number of times as that of the first inputted integer. Then, print out the array/list in reverse order, that is, starting from the last item on the array/list down to the first one, each in separated lines.
Input
The first line contains the size of the array/list.
The next lines contains the items of the array/list (integers).
5
1
64
32
2
11
Output
Multiple lines containing integers.
11
2
32
64
1
write a java display this output :
output format display:
student Name: Florence Cheng
Student id:10010005
Study mode: Part time
programme:
higher diploma in Computer Technology
Cerrent Level: Year 1
Number of modules take by the term : 4
Code Attendance Exam Mark Grade
cs101 100% 80 HD
cs102 69% 71 D
the module details please use Arraylist Record .
the student id of 8 digit and starts with 1001
the student name length maximum is 25 characters with space inclusive
the study mode could be " Full time "or "Part time"
the name of programmes could be selected form the list as shown in table below
the current level could be 1 and 2.1 (means year 1 and 2 means years 2)
the code could be selected form the list as shown in table below
by CodeChum Admin
I got my grandmother a new phone because I thought that we could talk more everyday by texting. Well, let’s just say that my grandma’s eyes aren’t the best anymore so she can’t really see what I text her and because of that she wants to ditch texting and stick with carrier pigeons. You know how embarrassing it is for a kid like me to be seen using carrier pigeons?!?! Well, anyway, I was hoping that you could make a program that takes my text and make it bigger, a LOT bigger. How about you test it out by only using the letters A, B, and C first.
Input
1. My text
Description
This is a string with characters A, B, and C.
Constraints
It is guaranteed that all letters are in uppercase.
Output
The first line will contain a message prompt to input my text.
The succeeding lines will contain the enlarged text.
Enter·my·text:·ABC
***·**··***
*·*·*·*·*
***·**··*
*·*·*·*·*
*·*·**··***The GCD
by CodeChum Admin
The greatest common divisor, also known as GCD, is the greatest number that will, without a remainder, fully divide a pair of integers.
Now, I want you to make a program that will accept two integers and with the use of loops, print out their GCD. Make good use of conditional statements as well.
Off you go!
Input
A line containing two integers separated by a space.
6·9
Output
A line containing an integer.
3
The Positive Ones
by CodeChum Admin
There are different kinds of numbers, but among them all, the most commonly used numbers in our daily lives are those positive ones. So, I only want you to count all the positive numbers from the 4 outputted values and print out the result.
Go and search for the positive ones among these four!
Input
A line containing four numbers (may contain decimal places) separated by a space.
2·-4·3.6·1
Output
A line containing an integer.
3
Placement session begins code by using array and integer in java plz help
Input an integer n which denotes the no of students present
by CodeChum Admin
We've been giving positive numbers too much attention lately, it's time to let negative numbers take the spotlight this time!
Instructions:
Instructions
Input
A line containing four decimals/floats separated by a space.
-30.22·10.5·-2.2·-1.8Output
A line containing a negative decimal/floats with two decimal places.
-34.22Write pseudo code that prints the smallest value among a list of numbers.
2. Write a subroutine named "printDayofWeek" that will output the day of the week for a given number. Use Swtich-case. For example, the command "1” would output “Sunday”.
3. The Car class (subclass) inherits the attributes and methods from the Vehicle class (superclass). And every car has model. Please also add toString method to the Car class to print out the brand, and model of the car.
Class Vehicle { protected String brand; Vehicle()
{
Brand = “Ford”; }
public void honk() { System.out.println("Tuut, tuut!");
} }
Please help write the Car class.
4. Try to refactor below codes for computing score (underlined part) with extract methods.
// Vehicle attribute
// Vehicle constructor
// Vehicle method
public class Customer {
void foo() {
int a, b, c, xfactor;
int
}