Hello I am greatly in need of help with this java lab excerc

Hello. I am greatly in need of help with this java lab excercise. We are using the NetBeans program in class, but am using Notepad++ to practive this because this computer doesn\'t have NetBeans. Can you PLEASE help!! This is so beyond me! Thank you so much!!

Conditional Statements Purpose The purpose of this lab is to introduce the use of boolean expressions involving Strings and Integers within conditional statements. objectives The objectives of this lab are: 1. Construct appropriate conditional statements that respond to user input 2. Explore the various notions of equality in Java 3. Perform simple arithmetic operations Import and Declarations We will need to import the Java Scanner class in order to create a Scanner object. We will also need to declare a number of variables to store the values entered by the user. 1. Locate the line that reads public class Main 2. Directly above this line, type: import java .util. Scanner; This statement imports the Java Scanner class.

Solution


import java.util.Scanner;

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/**
*
* @author Surya
*/

public class NewClass {
  
  
    public static void main(String argv[])
    {
  
            String testSchool = \"Oswego State\";
            String testMovie = \"Best in Show\";
            int testYear = 2017;
            int matchCount = 0;
            String userMovie, userSchool,line;
            int userYear;
          
            Scanner kb = new Scanner(System.in);
            System.out.println(\"Enter your school:\");
            userSchool = kb.nextLine();
          
            //conditional statments and comparisions
            if (testSchool.equals(userSchool))
            {
                System.out.println(\"Me too!\");
                matchCount = matchCount+1;
            }
            else
            {
                System.out.println(\"I hear \"+userSchool+\" is nice.\");
            }
          
          
            System.out.println(\"Enter the year you have Graduated:\");
            line = kb.nextLine();
            userYear = Integer.parseInt(line);
          
            if(userYear==testYear)
            {
                System.out.println(\"Me too!\");
                matchCount = matchCount+1;
            }
            else
            {
                System.out.println(\"I graduated in \"+testYear+\".\");
              
            }
          
            System.out.println(\"Enter your favorite movie:\");
            userMovie = kb.nextLine();
          
          
            if(userMovie.equals(testMovie))
            {
                System.out.println(\"Me too!\");
                matchCount = matchCount+1;
            }
            else
            {
                System.out.println(\"My favorite movie is \"+testMovie+\".\");
              
            }
          
          
            System.out.println(\"Our match count is :\"+matchCount);
            if(matchCount==3)
            {
                System.out.println(\"OMG! We\'re soulmates!\");
              
            }
            else if(matchCount==2)
            {
                 System.out.println(\"We have a lot in common\");
            }
            else if(matchCount<=1)
            {
                 System.out.println(\"We should get to know each other better\");
            }
  
    }
  
}


ouput:-


Enter your school:
Oswego State
Me too!
Enter the year you have Graduated:
2016
I graduated in 2017.
Enter your favorite movie:
Best in Show
Me too!
Our match count is :2
We have a lot in common

Hello. I am greatly in need of help with this java lab excercise. We are using the NetBeans program in class, but am using Notepad++ to practive this because th
Hello. I am greatly in need of help with this java lab excercise. We are using the NetBeans program in class, but am using Notepad++ to practive this because th

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site