Create a program that asks that asks the user for the number of males and females in a class. The program should display a percentage of males and females. For example, there are 5 males, and 15 females. That makes 20 people total. To find the percentage of males you can divide 5 by 20, which makes 0.25, or 25% HINT: USE A VARIABLE for every group of people that you will use in your calculation. Submit your .java source code and a screen capture of your program at runtime, including output.
Code:
import java.util.*;
public class MFPercentage
{
public static void main(String[] args)
{
Scanner cin=new Scanner(System.in);
System.out.println("Enter the no of male");
float M=cin.nextFloat();
System.out.println("Enter the no of female");
float F=cin.nextFloat();
float Total=M+F;
double MPercentage=(double)M/Total;
double FPercentage=(double)F/Total;
System.out.println("Male Percentage is : "+MPercentage);
System.out.println("Female Percentage is : "+FPercentage);
}
}
Screen of code and output
Please rate me positive if you like the answer
Create a program that asks that asks the user for the number of males and females...
Write a program that asks the user to input the number of males and females registered in a class (Max 30 members in the class). The program should display the percentage of males and females in the class. Python programming question
Create a java program that asks the user for their title (String) and their health level (int). Display their title and health level with ‘:’ between them. For example if they enter Wizard and 9 then display- Wizard:9 Thank you in advance
Write a Java program that: • Asks the user to enter the number of integers that he need to enter; • Asked him to enter integer by integer; • Print The number of Odd numbers entered and the number of Even numbers entered. Important notes: 1. You should have to copy and paste the Java as your answer for this question. DON’T take screen shot for your Java Code. It must be editable. 2. Take a screen shot for your...
***** JAVA ONLY ***** Write a program that asks the user to enter the name of a file, and then asks the user to enter a character. The program should count and display the number of times that the specified character appears in the file. Use Notepad to create a simple file that can be used to test the program. ***** JAVA ONLY *****
Create a Java program which asks the user how many names they want to enter. The program should then instantiate an array that will hold this many names. The main method should call a method, getNames() to allow the user to enter the names. A for loop should be used in this method. Once the names are entered, the main method should call another method displayNames() which will use a while loop to display the names entered.
1. Creatc a lava program thal asks the user to cnter his/her first name and last namc, in a single linc and separaled by a spacc. The program should output separately the first namc and the last name. (Use the Scanner class.) 2. Create a Java program thal asks the user for a medium (air, water or sleel), and outputs the speed of sound in thal medium (1 100 feclsec in air, 4900 feesec in water and 16,400 feet sec...
You are to write a program IN C++ that asks the user to enter an item's wholesale cost and its markup percentage. It should then display the item's retail price. For example: if the an item's wholesale cost is 5.00 and its markup percentage is 100%, then the item's retail price is 10.00 If an item's wholesale cost is 5.00 and its markup percentage is 50%, then the item's retail price is 7.50 Program design specs. You should have 5...
Write a C program that asks the user to enter two real numbers. Then your program displays a menu that asks the user to choose what arithmetic operation to be done on those numbers. Depending on the user's entry, the program should display the result to the screen. The sample runs below show what should be done to the numbers entered by the user. Your program should run exactly like shown in the sample runs. make your code run as...
Please create a Java Program, Using Netbeans JDK, that Asks the operator for 2 numbers, and the user's First and Last Name, and calculates the sum, difference, quotient, and product of the 2 numbers. The program should display to screen: "Hello ";{First Name Last Name} "The Sum is ": {Sum} "The Difference is ": {Difference} "The Product is: ": {Product} "The Quotient is ": {Quotient} Each student should post a Java program should have: (a) Pseudocode and (b) adjacent Java...
Use PYTHON3 to create a program that asks the user for their name, and then prints their initials. You must create a function called getInitials() that takes the name string and prints out the initials. It must be case insensitive and the initials must be printed in upper case. The program must contain a main() and a function called getInitials(), implemented as described in the function header comment given below. (You should include this function header comment in your own...