عرض مشاركة واحدة
منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 18-12-2011, 01:43 AM   #341

deathpain

devkemo

الصورة الرمزية deathpain

 
تاريخ التسجيل: Dec 2010
كلية: كلية الحاسبات وتقنية المعلومات
التخصص: Computer Science
نوع الدراسة: إنتظام
المستوى: الثامن
البلد: جــــدة
الجنس: ذكر
المشاركات: 770
افتراضي رد: Cpcs 202 شروحات وحلول وواجبات الجافا

المشاركة الأصلية كتبت بواسطة aroomh مشاهدة المشاركة
finding the highest score .. write a program that prompts the user to enter the number of students and each student's name and score,and finally displays the student with the highest score...
الحل:
كود PHP:
package goodquestion;
import java.util.*;
public class 
Goodquestion {
    public static 
void main(String[] args) {
        
int highestscore=0averagescore 0counter 1;
        
String higheststudentname "";
        
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){
        
System.out.print("\nenter student " counter " name: ");
        
String name input.next();
        
System.out.print("\nenter student " counter " score: ");
        
int score input.nextInt();
        if(
score highestscore){
        
highestscore score;
        
higheststudentname name;}
        
counter++;}
        
System.out.println(higheststudentname+" has the highest score "+highestscore);}

 

توقيع deathpain  

 



في حال وجود أي استفسار أو سؤال حول الجافا CPCS202 الرجاء كتابة استفسارك مباشرة في موضوعي هنا:

تطبيق - معدلي الجامعي - التطبيق الأسهل لحساب المعدل الجامعي
http://skaau.com/vb/showthread.php?t=745520

 

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