What's new

Help Java Programming

Pahelp Po, kung paano Po magcode nito.

Using Netbeans, create a program that ask the user for the number of male and female students registered in a class/section. the program should display the total number of students and the percentage of males and females in the class.

Sample Output

Enter of the number of males: 36 Enter the number of females: 17 Number of students: 50
Male: 67.92%
Female: 32.08%
 
Ito Po...Pahelp Po pls. Kailangan na Kasi po namin bukas...Salamat po

create a program that ask the user for the number of male and female students registered in a class/section. the program should display the total number of students and the percentage of males and females in the class.

Sample Output

Enter of the number of males: 36 Enter the number of females: 17 Number of students: 50
Male: 67.92%
Female: 32.08%
Pm moko para ma bigay ko sayo code
BSIT 1st year ako java rin now
 
Ito Po...Pahelp Po pls. Kailangan na Kasi po namin bukas...Salamat po

create a program that ask the user for the number of male and female students registered in a class/section. the program should display the total number of students and the percentage of males and females in the class.

Sample Output

Enter of the number of males: 36 Enter the number of females: 17 Number of students: 50
Male: 67.92%
Female: 32.08%
Nag pm ako
 
Nag pm ako
Hello paps pwede patulong? Tambak kasi ako ng coding activities :<. Baka alam mo din toInterest is compounded annually at 10% by a certain bank. Make a program that would
input an amount and a number of years (the program should test that both are positive)
and output how much the original amount will be worth after that period.
 
import java.util.Scanner;

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

System.out.print("Enter the number of male students: ");
int numMale = scanner.nextInt();

System.out.print("Enter the number of female students: ");
int numFemale = scanner.nextInt();

int total = numMale + numFemale;
double malePercent = (double) numMale / total * 100;
double femalePercent = (double) numFemale / total * 100;

System.out.println("Total number of students: " + total);
System.out.println("Percentage of males: " + malePercent + "%");
System.out.println("Percentage of females: " + femalePercent + "%");
}
}
 
Super late na ng reply pero ito yung approach ko.

import java.util.*; import java.io.*; public class RegStudentPercentage { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter of the number of males: "); int males = Integer.parseInt(br.readLine()); System.out.print("Enter of the number of females: "); int females = Integer.parseInt(br.readLine()); int total = males + females; System.out.printf("Male: %.2f%%\n", (males / (total+0.0) * 100)); System.out.printf("Female: %.2f%%\n", (females / (total+0.0) * 100)); } }
 

Similar threads

Back
Top