2.14. Male and Female Percentages - Java

in coding •  8 years ago  (edited)

Starting out with Java: From control structures through objects

Chapter 2

Programming Challenges

14. Male and Female Percentages

Write a program that asks the user for the number of males and the number of females registered in a class. The program should display the percentage of males and females in the class. Hint: Suppose there are 8 males and 12 females in a class. There are 20 students in the class. The percentage of males can be calculated as 8 / 20 = 0.4, or 40%. The percentage of females can be calculated as 12 / 20 5 = 0.6, or 60%.

Gaddis, Tony (2015-05-29). Starting Out with Java: From Control Structures through Objects (6th Edition) (Page 107). Pearson. Kindle Edition. 

Happy Steeming Everyone! :)

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!