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 9149959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:32:54+00:00 2026-06-17T11:32:54+00:00

All I am trying to do is create a simple pay calculator. The user

  • 0

All I am trying to do is create a simple pay calculator. The user types in their baseSalary, their totalSales, and their commissionRate. The program runs just fine, but the totalPay isn’t comming out right. Any help would be awesome. This is most likely a simple fix, but as this is only my second day of my VB class I am clueless as how to fix this. Thank you in advance for any help given!

'   Total Pay Calculator
'   By: Jeremy Flaugher
'   01/17/2013


Module myPay
    Sub Main()
        '   Declare the variables
        Dim baseSalary As Integer
        Dim totalSales As Integer
        Dim commissionRate As Decimal
        Dim totalPay As Integer

        '   Title and By line
        Console.Out.WriteLine("Welcome to the Paycheck Calculator")
        Console.Out.WriteLine("Created by Jeremy Flaugher" & vbCrLf)

        '   User Prompts
        Console.Out.Write("Please enter your Base Salary: $")
        baseSalary = Console.In.ReadLine()

        Console.Out.Write("Please enter your number of sales: ")
        totalSales = Console.In.ReadLine()

        Console.Out.Write("Please enter your Commission Rate in decimal form: ")
        commissionRate = Console.In.ReadLine()

        '   Processes
        totalPay = (totalSales * commissionRate) + baseSalary
        Console.Out.WriteLine("Your paycheck will total: " & (FormatCurrency(totalPay)))
        Console.ReadKey()
    End Sub
End Module

I am checking the output on a calculator after running the program. Say I enter $100 as the base pay, 5 as the number of sales, and .5 as the commission rate. On the calculator I am getting $102.5 as the total pay, but the when running the program I am getting $102.00. How can I fix this.

  • 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-17T11:32:55+00:00Added an answer on June 17, 2026 at 11:32 am

    First of all I would put Option Strict On at the top of your module, it is good practice and will save you grief trying to figure out why things are not correct. In your case I believe your problem is that you are using a decimal as part of your calculation but you are putting the result into an Integer. Try declaring totalPay as a Decimal also.

    The benefits of using Option Strict from above link:

    When you set Option Strict to On, Visual Basic checks that data types are specified for all programming elements. Data types can be specified explicitly, or specified by using local type inference. Specifying data types for all your programming elements is recommended, for the following reasons:

    • It enables IntelliSense support for your variables and parameters.
      This enables you to see their properties and other members as you
      type code.
    • • It enables the compiler to perform type checking. Type checking
      helps you find statements that can fail at run time because of type
      conversion errors. It also identifies calls to methods on objects
      that do not support those methods.
    • • It speeds up the execution of code. One reason for this is that if
      you do not specify a data type for a programming element, the Visual
      Basic compiler assigns it the Object type. Compiled code might have
      to convert back and forth between Object and other data types, which
      reduces performance.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a simple program where a user enters a few letters
i'm trying to create a simple Opencv program in C that creates a file
I'm trying to create a simple app, what moves all files writed to some
Hi all trying to create a simple database login java servlet. It's going straight
I am trying to create a simple Network Tool to ping all possible IPs
I'm trying to create a simple for loop that will take all the outputs
I'm trying to create a simple User & Address Model. I've created a nested
I'm trying to create a simple Zip archive that contains all the javascript files
Hie all , I am trying to create an simple application and i want
I'm trying to create a simple address screen where the user has a single

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.