diff --git a/44adc3e1-bbc6-46b2-8bb3-633ad4cdccc2.jpg b/44adc3e1-bbc6-46b2-8bb3-633ad4cdccc2.jpg new file mode 100644 index 0000000..f1f786e Binary files /dev/null and b/44adc3e1-bbc6-46b2-8bb3-633ad4cdccc2.jpg differ diff --git a/Basics_II/src/main/java/com/example/BasicII.java b/Basics_II/src/main/java/com/example/BasicII.java index 2e9b4b5..eefc6c2 100644 --- a/Basics_II/src/main/java/com/example/BasicII.java +++ b/Basics_II/src/main/java/com/example/BasicII.java @@ -2,6 +2,7 @@ package com.example; import java.util.Scanner; public class BasicII { + public static void main(String[] args) { System.out.println("Hello world!"); @@ -70,6 +71,70 @@ public class BasicII { System.out.println("Free"); } + Welcome(); + + /* + You are making an automated response program for a store. + The bot should take a number from the user as input and reply with an automated message. + There are currently 3 responses, that you need to a handle: + User message: "1", Reply: "Order confirmed" + User message: "2", Reply: "info@sololearn.com" + For any other number, the reply should be: "Try again". + The given code calls a method called bot(). Define the method, which should take an integer input from the user, and handle the above mentioned cases, by outputting the corresponding reply. + Do not change the method call in main(). + */ + bot(); + + + /* + You need to make a method that converts a foot value to inches. + 1 foot has 12 inches. + Define a convert() method, that takes the foot value as its argument and outputs the inches value. + The result must be a double. + */ + double num = sc.nextDouble(); + convert(num); + + /* + You are making a Celsius to Fahrenheit converter. + Write a method to take the Celsius value as an argument and return the corresponding Fahrenheit value. + Sample Input + 36 + Sample Output + 96.8 + The given code takes the celsius value as input and passes it to a fahr() method, which you need to create. + */ + double c = sc.nextDouble(); + System.out.println(fahr(c)); } + + static double fahr(double cels){ + return 1.8*cels+32; + } + + static void convert(double nm){ + System.out.println(nm*12); + } + + static void Welcome(){ + System.out.println("Welcome!!"); + } + + static void bot(){ + Scanner sc = new Scanner(System.in); + int num = sc.nextInt(); + + switch (num) { + case 1: + System.out.println("Order confirmed"); + break; + case 2: + System.out.println("info@sololearn.com"); + break; + default: + System.out.println("Try again"); + break; + } + } } \ No newline at end of file diff --git a/Basics_II/target/classes/com/example/BasicII.class b/Basics_II/target/classes/com/example/BasicII.class index 2bfbf09..978ddb5 100644 Binary files a/Basics_II/target/classes/com/example/BasicII.class and b/Basics_II/target/classes/com/example/BasicII.class differ diff --git a/CertificateLink.txt b/CertificateLink.txt new file mode 100644 index 0000000..9ee331f --- /dev/null +++ b/CertificateLink.txt @@ -0,0 +1 @@ +https://www.sololearn.com/certificates/CC-WHOYREFK \ No newline at end of file diff --git a/bdb9720d-bbf1-488e-9d94-0d16f18896e9.pdf b/bdb9720d-bbf1-488e-9d94-0d16f18896e9.pdf new file mode 100644 index 0000000..2ef87f1 Binary files /dev/null and b/bdb9720d-bbf1-488e-9d94-0d16f18896e9.pdf differ