1. Write a java program that will display the numbers 1 to 100.Classify each num
ID: 3619041 • Letter: 1
Question
1. Write a java program that will display the numbers 1 to 100.Classify eachnumber as Odd or Even Numbers.
Expected Result:
1 is an Odd Number
2 is an Even Number
2. Define a class, MCMLength, to represent a length measured inmeters,
centimeters, and millimeters, each stored as integers. Includemethods to add
and subtract objects, to multiply and divide an object by aninteger value, to
calculate an area resulting from the product of two objects, and tocompare
objects. Include constructors that accept threearguments—meters, centimeters,
and millimeters; one integer argument in millimeters; one doubleargument in
centimeters; and no arguments, which creates an object with thelength set to
zero. Check the class by creating some objects and testing theclass operations.
thanks!
Explanation / Answer
/* 1. Write a java program that will display the numbers 1 to 100.Classify eachnumber as Odd or Even Numbers.
Expected Result:
1 is an Odd Number
2 is an Even Number */
public class cramster { public static void main(String args[]) { for(int v=1;v<101;v++) { if(v%2==1) system.out.println(v+" is an odd number"); else system.out.println(v+" is an even number"); } } } 1. Write a java program that will display the numbers 1 to 100.Classify each
number as Odd or Even Numbers.
Expected Result:
1 is an Odd Number
2 is an Even Number
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.