school help: I need some help with Java. - Help.com

digitalsamurai0
offline Verified (1 year) Visit digitalsamurai0's shoutbox
An Unknown Location

I need some help with Java.

I am an AP Computer Science student and cannot get a piece of code to work. The goal is to use a scanner class to open up one of two classes written. i have been studying my code and cannot figure out what is wrong. Any suggestions?

import java.util.Scanner;

public class Interface {
public static void main (String[] args){

//Define Final Variables
final int mph = 1;
final int mpm = 2;

//Display Message On Execution
System.out.println(”Please Enter ‘1′ to Convert From MPH to MPM”);
System.out.println(”Please Enter ‘2′ to Convert From MPM to MPH”);

//Read User Input
Scanner in = new Scanner(System.in);
int s = in.nextInt();

//Select Which Conversion Class to Use
if (s == mph)
new MPH();

if (s == mpm)
new MPM();

//Checks for Invalid User Input
if (s!=mph || s!=mpm)
System.out.println(”Error 404. File not found.”);
}
}

This closed post was written 11 months, 3 weeks ago | V/U/S: 104, 2, 1 | Edit Post | Report Post


Reciprocity (0) Reciprocation Failure -- The poster has NOT helped anyone else yet!

Since writing this post digitalsamurai0 may have helped people, but has not within the last 4 days. digitalsamurai0 is a verified member, has been around for 1 year and has 1 posts and 1 replies to their name.

Post Tags (7)

Replies (2)

Where were you?

Click and drag to move the map around. FAQ: How we place people on this map »
You can also watch events on Help.com as they happen
Mouse over the map for 2 seconds to see an expanded, interactive view

digitalsamurai0 changed the tags on this post: they were "java, system, code, Public, Input, class, scanner, Final, ENTER, User, Computers, school" 11 months, 3 weeks ago.

digitalsamurai0 closed this post.

This post has been closed, no more replies. Thanks!

Invite Others to Help

Seeing as this post is closed, no invites are allowed.