I am glad I tried the exercises first. I used method to write my code since we are learning about method. If anyone wants to see my code, I'll post it.
you have made java interesting for me, just when i was almost giving up on it..can't seem to find anything on arrays. if you could please help with that as well... Bless up.
package Method; import java.util.Scanner; public class Methods { public static void main(String[] args) { int number =0;
System.out.println(" hi enter a number ");
Scanner input= new Scanner(System.in);
number= input.nextInt();
if (number==1) { spring();} else if ( number ==2 ) summer(); else if ( number ==3) autum(); else if ( number == 4) winter(); else System.out.println( " be sure the number from 1 to 4");
}
public static void spring() { System.out.println( " it is spring"); } public static void summer () { System.out.println( " it is summer "); } public static void autum () { System.out.println( " it is autum ");} public static void winter () { System.out.println( " it is winter ");} }
to every CS student checking the comments to see if this is worth watching public static void printRecommendation(){ System.out.println("this is the best"); }
package lesson1; import java.util.Scanner; public class Lesson1Exercise { public static void main(String[] args) { Scanner input = new Scanner(System.in); int userInput; System.out.println("Please enter a season of your choice. 1 = Spring 2 = Summer 3 = Fall 4 = Winter ");
do { userInput = input.nextInt(); switch(userInput) { case 1: printSpring(); break; case 2: printSummer(); break; case 3: printFall(); break; case 4: printWinter(); break; default: System.err.println("Enter a seasonal number between 1-4: "); break; } }while((userInput < 1) || (userInput > 4)); }
public static void printSpring() { System.out.println("The season is Spring, and the flowers are blooming!"); }
public static void printSummer() { System.out.println("The season is Summer, and it is getting hot!"); }
public static void printFall() { System.out.println("The season is Fall, and leaves are falling!"); }
public static void printWinter() { System.out.println("The season is Winter, and it is snowing!"); } }
i spent a while trying to add a way to send an error message if you type something other than an integer but could not work out what structure it would work in
import java.util.Scanner; public class JavaLearn { public static void main(String[] args) { Scanner sezoane = new Scanner(System.in); int numar = 1;
System.out.println("Pentru fiecare sezon on parte scrie de la 1 la 4"); numar = sezoane.nextInt(); if (numar == 1) { printPrimavara; if (numar == 2) { printVara(); if (numar == 3) { printToamna(); if (numar == 4) { printIarna(); } public static void printPrimavara () { System.out.println("Este primavara si este totul numai flori"); } public static void printVara () { System.out.println("Este vara si caldura este infernala"); } public static void printToamna () { System.out.println("Este toamna, iar frigul si frunzele se lasa"); } public static void printIarna () { System.out.println("A venit iarna si zapada este prezenta peste tot"); } } What is wrong here because does not work
I don't have any kind of method to return my "Gratitude" into your method.. It's all void.
UR THE BEST
The best out there on this topic!
You can also switch case and call the methods from another class.
I am glad I tried the exercises first. I used method to write my code since we are learning about method. If anyone wants to see my code, I'll post it.
you have made java interesting for me, just when i was almost giving up on it..can't seem to find anything on arrays. if you could please help with that as well... Bless up.
th-cam.com/video/2eKjuhzI87g/w-d-xo.html
Another really helpful video! Thank you
package Method;
import java.util.Scanner;
public class Methods {
public static void main(String[] args) {
int number =0;
System.out.println(" hi enter a number ");
Scanner input= new Scanner(System.in);
number= input.nextInt();
if (number==1) {
spring();}
else if ( number ==2 )
summer();
else if ( number ==3)
autum();
else if ( number == 4)
winter();
else System.out.println( " be sure the number from 1 to 4");
}
public static void spring() {
System.out.println( " it is spring");
}
public static void summer () {
System.out.println( " it is summer ");
}
public static void autum () {
System.out.println( " it is autum ");}
public static void winter ()
{
System.out.println( " it is winter ");}
}
Can i buy the whole volume in Blu-Ray?
Sorry I don't make them on blu-ray. For the highest resolution, visit www.mathtutordvd.com and you can purchase the set as a download. Thank you!
@@MathAndScience ThankX for free!
very well explained
to every CS student checking the comments to see if this is worth watching
public static void printRecommendation(){
System.out.println("this is the best");
}
package lesson1;
import java.util.Scanner;
public class Lesson1Exercise {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int userInput;
System.out.println("Please enter a season of your choice.
1 = Spring
2 = Summer
3 = Fall
4 = Winter
");
do {
userInput = input.nextInt();
switch(userInput) {
case 1: printSpring();
break;
case 2: printSummer();
break;
case 3: printFall();
break;
case 4: printWinter();
break;
default: System.err.println("Enter a seasonal number between 1-4: ");
break;
}
}while((userInput < 1) || (userInput > 4));
}
public static void printSpring() {
System.out.println("The season is Spring, and the flowers are blooming!");
}
public static void printSummer() {
System.out.println("The season is Summer, and it is getting hot!");
}
public static void printFall() {
System.out.println("The season is Fall, and leaves are falling!");
}
public static void printWinter() {
System.out.println("The season is Winter, and it is snowing!");
}
}
i spent a while trying to add a way to send an error message if you type something other than an integer but could not work out what structure it would work in
import java.util.Scanner;
public class JavaLearn {
public static void main(String[] args) {
Scanner sezoane = new Scanner(System.in);
int numar = 1;
System.out.println("Pentru fiecare sezon on parte scrie de la 1 la 4");
numar = sezoane.nextInt();
if (numar == 1) {
printPrimavara;
if (numar == 2) {
printVara();
if (numar == 3) {
printToamna();
if (numar == 4) {
printIarna();
}
public static void printPrimavara () {
System.out.println("Este primavara si este totul numai flori");
}
public static void printVara () {
System.out.println("Este vara si caldura este infernala");
}
public static void printToamna () {
System.out.println("Este toamna, iar frigul si frunzele se lasa");
}
public static void printIarna () {
System.out.println("A venit iarna si zapada este prezenta peste tot");
}
}
What is wrong here because does not work
You do not need an opening bracket for each of the if statement. It is reading as a single line.
@@ryanchau103 🙏