Click here to Skip to main content
15,888,454 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
A college offers a course that prepares students for a state licensing exam. You've been given a list of 10 students. Next to each name is written a 1 if the student passed the exam or a 2 if the student failed. Write a Java program to: Count the number of test results of each type(pass-fail). Display a summary of the test results. - - If more than eight students passed the exam


(((I solved the question as requested, but it didn't get out)))

What I have tried:

Java
package javaapplication20;
import java.util.*;
public class JavaApplication20 {

 
 
    public static void main(String[] args) {
         Scanner input=new Scanner(System.in);
         int passes = 0; 
         int failures = 0; 
         int result = 0; 
         int student = 1; 
        
         while ( student <= 10 ){
             
             System.out.print("Enter result (1=pass,2= fail) :" );
             student =input.nextInt();
           
             if ( result == 1 ) 
             
              
                passes = passes + 1;   
             else  
                failures = failures + 1; 
           student=student+1;
         }
         System.out.println("passes:" );
         System.out.println("failures:" );
           
         if ( passes > 8 )
         
         {
             System.out.println("Raise tuition" );
         }
         }
    }
Posted
Updated 8-Oct-22 10:23am
v2
Comments
OriginalGriff 8-Oct-22 15:34pm    
And?
What does it do that you didn't expect, or not do that you did?
Where are you stuck?
What have you tried to fix it?
What help do you need?
Member 15766438 8-Oct-22 16:20pm    
Thank you I managed to solve it
OriginalGriff 8-Oct-22 16:22pm    
Excellent!

1 solution

Answered only to remove from the unanswered list - solved by OP.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900