Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9144581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:18:16+00:00 2026-06-17T10:18:16+00:00

This is my second programming class so please bear with me. I have an

  • 0

This is my second programming class so please bear with me.
I have an assignment that requires me to create an RPN Calculator with functions.
It’s my first time learning about functions so I’m still confused.

My question is: The operator (+, -, *, /, etc.) when entered by the user should do what’s asked. But I was thinking of using “If statement” for each operator. I tried “if (oper == ‘+’) but it wouldn’t work. Second time around, I tried as seen underneath. Fail! Illegal start of expression. Frustrating! Does anyone have any ideas of how I could start? And the worse part is I have no idea of how to put the operators in functions. Any help would be appreciated! Thank you.

    String oper;
    double x, y;
    double sum;

    System.out.print("X: ");
    x = keyboard.nextDouble();

    System.out.print("Y: ");
    y = keyboard.nextDouble();

    System.out.print("Op: ");
    oper = keyboard.nextLine();

    if (oper.equals(+))
        System.out.print("add");
        System.out.println();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T10:18:17+00:00Added an answer on June 17, 2026 at 10:18 am

    oper = keyboard.nextLine(); is not right because .nextLine skip the next line of code so the thing you put oper would be empty. Try: oper = keyboard.next();

    For the if statement try:

    if(oper.charAt(0)=='+'){
      //the functions and whatever else you need
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following paragraphs: <p>This is a first paragraph.</p> <p>This is a second</p>
I am taking a Coursera Functional Programming in Scala class. This is the second
So I just started my second programming class in Java, and this is the
I'm a programming student in my second OOP class, my first class was taught
Greetings everyone. This is my first question here at stackoverflow so please bear with
I have a programming assignment to write a program in C++ that finds all
How can I make this second struct work, when the first struct has a
This is my second question on Bamboo ( My First One ). My understanding
this is the second game that I'm having issues with in the same area...
If this is the first string : ABCD if this is the second string:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.