3 Replies - 325 Views - Last Post: 17 June 2013 - 06:24 AM Rate Topic: -----

#1 WINDY11965  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 17-June 13

Code won't build using NetBeans I tink I am settig class up wrong

Posted 17 June 2013 - 05:24 AM

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import java.util.Scanner;

/**
 *
 * @author Windy
 */
public class Commission {

  public static void main(String[] args) {
  Scanner in = new Scanner(System.in);

  System.out.print("Please enter your total annual sales: $");
  Double sales = in.nextDouble();

  System.out.println("The total annual sales of $" + sales + " and a yearly salary of $40,000 will provide you with a total compensation of $" + calcComp(sales));
  }

  public static double calcComp(double sales) {
  double compensation = 40000 + (0.08 * sales);
  compensation = (double) (Math.round(compensation*100))/100;
  return compensation;
   
  }
}

This post has been edited by GregBrannon: 17 June 2013 - 05:37 AM
Reason for edit:: Fixed code tags.


Is This A Good Question/Topic? 0
  • +

Replies To: Code won't build using NetBeans I tink I am settig class up wrong

#2 GregBrannon  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2194
  • View blog
  • Posts: 5,222
  • Joined: 10-September 10

Re: Code won't build using NetBeans I tink I am settig class up wrong

Posted 17 June 2013 - 05:40 AM

Are you getting errors? If so, post them, copied from your terminal and pasted into a post so that we see exactly what you see.
Was This Post Helpful? 0
  • +
  • -

#3 WINDY11965  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 17-June 13

Re: Code won't build using NetBeans I tink I am settig class up wrong

Posted 17 June 2013 - 05:44 AM

NO errors just wont build just keeps running and running......
Was This Post Helpful? 0
  • +
  • -

#4 GregBrannon  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2194
  • View blog
  • Posts: 5,222
  • Joined: 10-September 10

Re: Code won't build using NetBeans I tink I am settig class up wrong

Posted 17 June 2013 - 06:24 AM

Your terminology may be confusing. I'm not sure what you mean by "running and running."

The code you posted seems to be fine, so maybe you don't know how to use your IDE of choice. There should be a Terminal or Console view, perhaps in a tab, that you can switch to while the program is running to interract with your program as a user would do if running from the command line.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1