عرض مشاركة واحدة
منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 20-11-2011, 08:28 PM   #75

Prince soma

Super Hussam

الصورة الرمزية Prince soma

 
تاريخ التسجيل: Sep 2011
التخصص: IT
نوع الدراسة: إنتظام
المستوى: الرابع
الجنس: ذكر
المشاركات: 266
افتراضي رد: Cpcs 202 شروحات وحلول وواجبات الجافا

المشاركة الأصلية كتبت بواسطة SPIDER مشاهدة المشاركة
الكود



كود PHP:
import java.util.Scanner;

public class 
Test
{
    public static 
void main(String[] args)
    {
        
int lowestScore 100 /* Make it max score first */averageScore 0counter 1;
        
String lowestStudentName "";
        
Scanner input = new Scanner(System.in);
        
        
System.out.print("Enter the number of students: ");
        
int studentsCount input.nextInt();
        if(
studentsCount <= 0System.exit(0);
        
        while(
counter <= studentsCount)
        {
            
input.nextLine(); // To discard "\n"
            
            
System.out.print("Enter student " counter " name: ");
            
String name input.nextLine();
            
            
System.out.print("Enter student " counter " score: ");
            
int score input.nextInt();
            
            if(
score lowestScore)
            {
                
lowestScore score;
                
lowestStudentName name;
            }
            
averageScore += score;
            
counter++;
        }
        
        
averageScore /= studentsCount;
        
System.out.println(lowestStudentName " has the lowest score (" lowestScore ") and the average score is " averageScore);
    }

جزاك الله خير بس فيه مشكله انت عرفت score على انه int بس في السؤال طالب يكون دبل

 

Prince soma غير متواجد حالياً   رد مع اقتباس