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

  • Home
  • SEARCH
  • 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 8911941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:04:35+00:00 2026-06-15T04:04:35+00:00

I am a Java developer and I’m just starting to teach myself c++ as

  • 0

I am a Java developer and I’m just starting to teach myself c++ as well. I know some of the differences between Java and c++ but I’m not sure what is going on here. Here is the code I am having a problem with. Its just from a tutorial so I’m not worried about accuracy.

void calculateHourly() {
    float totalWeeklyWage = mFltHourlySalary * mIntHoursWorked;
    float totalSales = mIntCostOfShoe * mIntUnitsSold;
    float totalCommission = (mIntHourlyCommission / 100) * totalSales;
    float grandTotalWage = totalWeeklyWage + totalCommission;

    cout << "You will get $" << grandTotalWage << " for selling " << mIntUnitsSold << " shoes in a week."
        << endl;
}

The problem is the line

float totalCommission = (mIntHourlyCommission / 100) * totalSales;

For whatever reason totalCommission = 0 when this method is done running. I have debugged this and all the other variables in this method equal what they are supposed to be equal to. With my Java cap on and the little knowledge I have of c++ tell me this should be working.

Am I missing something painfully simple in this method or is there a greater issue at hand? Any and all help is greatly appreciated.

  • 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-15T04:04:36+00:00Added an answer on June 15, 2026 at 4:04 am

    The following uses integer division, the result of which is also integer:

    mIntHourlyCommission / 100
    

    Either cast mIntHourlyCommission to float, or turn 100 into a float literal: 100.0f.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not a Java developer so I might get some terms wrong... but. An
I'm not a Java developer, but work with a team that is using JSF
I'm a java developer, not seasoned, but I am familiar with most concepts reasonably
I consider myself an experienced Java developer and am planning to get started with
I heard this today during interview for java developer. I had to list some
I am a java developer, but I have had to learn C++ recently and
I'm a Java developer looking to learn some C#/ASP.NET. One thing I've never liked
I'm a beginner java developer and i'm not very confident with java world tools.
I'm a Java developer being forced to learn C#. Since I couldn't stand NOT
I am java developer, (using Spring-MVC) never worked much on javascript, But I would

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.