Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Loops and Arrays  RSS feed

 
Wendy Thiel
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The attched picture is the programming i am stuck on. I need the array loop to take the salary's multiply them by 10% and then display them. I can't get Java to multiply the Salary by 0.1 and store. What am i doing wrong? Please help
HELP.jpg
[Thumbnail for HELP.jpg]
 
praveen kumaar
Ranch Hand
Posts: 461
22
Android Chrome Eclipse IDE Google App Engine Java Notepad Oracle Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello wendy,welcome to ranch!
you need to do this

next time please use code tags for displaying your code.

Hope this will help!

kind regards,
Praveen.
 
Junilu Lacar
Sheriff
Posts: 11138
160
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

When posting code, please use code tags instead of attaching screen shots like that.

Your array is declared as an array of String objects. The value you are attempting to assign to an array element is going to be a double (a number).  You can't do that. If you are going to deal with numbers, then declare your array as a number type (int, long, float, double) and don't put quotes around your literal values (the numbers you are initializing the array with).  If you are going to use a multiplier like 0.5, that is a double and any expression that contains it will be automatically converted to a double.

See the Java Tutorials section on Primitive Types
 
praveen kumaar
Ranch Hand
Posts: 461
22
Android Chrome Eclipse IDE Google App Engine Java Notepad Oracle Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See this link for Ranch Guide and how to post.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!