Visual basic - simple beginner program question

I have a friend writing a entry level VB app but I do not know VB - can you correct the following code? Looks like a VERY simple calculator...

Andrea Cortez
 * CS123-0804A-04
 * Problem Solving and programming Concepts
 * Jeffrey Unger
 * Colorado Technical University Online
 * November 2, 2008
 */
package lab4;
import java.util.Scanner;

/**
 *
 * @author MandaPiggy
 */
public class Main {
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // int a, b, c, d, x;
        int n1, n2;
       
        Scanner keyboard = new Scanner (System.in);
        // This is the starting of the program//
        System.out.println("Please enter first number:");
        // This is the first step in the program//
        n1 = keyboard.nextInt();
        // This is how the program will read the first step//
        System.out.println("Choose a letter:");
       
        if (a = add) {
           then (n1 + n2 = x);
        }else if (b = subtract) {
           then (n1 - n2 = x);
        }else if (c = multiply) {        
           then (n1 * n2 = x);
        }else if (d = divide) {
           then (n1/n2 = x);
         class.lab4.Main();
       
        }
        System.out.println ("Enter second number:");
        n2 = keyboard.nextInt();
        System.out.println ("The total is" + (n1 + n2));  
       
    }
}
init:
deps-jar:
Compiling 1 source file to C:\Documents and Settings\MandaPiggy\My Documents\NetBeansProjects\Lab4\build\classes
C:\Documents and Settings\MandaPiggy\My Documents\NetBeansProjects\Lab4\src\lab4\Main.java:42: <identifier> expected
         class.lab4.Main();
C:\Documents and Settings\MandaPiggy\My Documents\NetBeansProjects\Lab4\src\lab4\Main.java:42: <identifier> expected
         class.lab4.Main();
C:\Documents and Settings\MandaPiggy\My Documents\NetBeansProjects\Lab4\src\lab4\Main.java:50: reached end of file while parsing
}
3 errors
BUILD FAILED (total time: 0 seconds)

Thanks!
Karl66Asked:
Who is Participating?
 
vbsquickresponseConnect With a Mentor Commented:
Do you want this program to rewritten in VB?  Looking at the code its looks like java code to me!

What add, substract, multiply means in the code? have u declare them somewhere or they are keywords?

        if (a = add) {
           then (n1 + n2 = x);
        }else if (b = subtract) {
           then (n1 - n2 = x);
        }else if (c = multiply) {        
           then (n1 * n2 = x);
        }else if (d = divide) {

error shown becz of them might be!
0
 
GrahamSkanRetiredCommented:
The main problem is that the code isn't VB.
It looks like Java. Or is could be JavaScript, C# or one of those languages with syntax derived from C.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.