Posts

METHODS FIRST ASSIGNMENT (EVEN AND ODD CHECKR)

Temperature Q2 import java.util.Scanner; public class Temperature { static void validation(Scanner input){ while(!input.hasNextInt()) { System.out.println("YOU have enter a letter where a number is expected"); System.out.println("Please try again"); input.next(); } } static int celsius(int a){ int d = a + 32; return d * 9/5; } static int fahr(int a ){ int d = a -32; return d * 5/9; } public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("============================================"); System.out.println(" TEMPERATURE CONVERTER"); System.out.println("============================================="); System.out.println(" "); System.out.println("Enter the number or the value of the temperature you...

leap year

  import java.util.Scanner; public class even { public static void main (String[] args) { System. out .println( "Enter a number to determine the if it is a leap year or not" ); Scanner input = new Scanner(System. in ); while (!input.hasNextInt()){ System. out .println( "Enter a whole number" ); input.next(); } int number; number = input.nextInt(); if (number % 400 == 0 ){ System. out .println(number + " " + "is a leap year" ); } else { System. out .println(number + " " + "is not a leap year" ); } } }

Day of the week checker

  import java.util.Scanner; public class even { public static void main (String[] args) { Scanner input = new Scanner(System. in ); System. out .println( "Enter a number ranging from 1- 7 to know the corresponding month" ); int range = input.nextInt(); while (range < 1 || range > 7 ){ // keeps the user in this loop as long as the condition remain true// System. out .println( "You have enter an invalid number" ); System. out .println( "Enter a number ranging from 1- 7 to know the corresponding month" ); range = input.nextInt(); } switch (range){ // This checks the input from the user and print the condition that meets the corresponding case case 1 : System. out .println( "Sunday" ); break ; case 2 : System. out .println( "Monday" ); break ; case ...

IPAM GRADING SYSTEM

  import java.util.Scanner; public class even { public static void main (String[] args) { System. out .println( "Enter module 1" ); Scanner input = new Scanner(System. in ); while (!input.hasNextDouble()) { System. out .println( "Enter a number not a letter" ); input.next(); } int module1; module1 = input.nextInt(); while (module1 < 0 || module1 > 100 ) { System. out .println( "Enter a number between 1 and 100" ); while (!input.hasNextDouble()) { System. out .println( "Enter a number not a letter" ); input.next(); } module1 = input.nextInt(); if (module1 >= 70 ) { System. out .println( "A" ); } else if (module1 >= 60 && module1 <= 69 ) { System. out .println( "B" ); ...

THREE MODULES CHECKER

  import java.util.Scanner; public class even { public static void main (String[] args) { System. out .println( "THIS SYSTEM CHECKS ANY THREE MODULES AND OUTPUT THE AVERAGE" ); System. out .println( "Enter module 1" ); Scanner input = new Scanner(System. in ); while (!input.hasNextDouble()){ System. out .println( "Enter a number not a letter" ); input.next(); } int module1; module1 = input.nextInt(); while (module1< 0 || module1 > 100 ){ System. out .println( "Enter a number between 1 and 100" ); while (!input.hasNextDouble()){ System. out .println( "Enter a number not a letter" ); input.next(); } module1 = input.nextInt(); } System. out .println( "Enter module 2" ); while (!input.hasNextDouble()){ System. out .pri...

EVEN AND ODD EXAMINER

  import java.util.Scanner; public class even { public static void main (String[] args) { System. out .println( "Enter a number to determine the if it is even or odd number" ); Scanner input = new Scanner(System. in ); while (!input.hasNextInt()){ System. out .println( "Enter a whole number" ); input.next(); } int number; number = input.nextInt(); if (number % 2 == 0 ){ System. out .println(number + " " + "is an Even number" ); } else { System. out .println(number + " " + "is an Odd number" ); } } }

Month of the year checker

  import java.util.Scanner ; public class months_of_the_year { public static void main ( String [] args ) { Scanner input = new Scanner ( System . in ); System . out . println ( "Enter a number ranging from 1- 12 to know the corresponding month" ); int range = input . nextInt (); while ( range < 1 || range > 12 ){ // keeps the user in this loop as long as the condition remain true// System . out . println ( "You have enter an invalid number" ); System . out . println ( "Enter a number ranging from 1- 12 to know the corresponding month" ); range = input . nextInt (); } switch ( range ){ // This checks the input from the user and print the condition that meets the corresponding case case 1 : System . out . println ( "January" ); break ; case 2 : System . out . println ( "February...