InstagramTwitterSnapChat


 
وصف

العودة   منتديات سكاو > الكليات الجامعية > منتدى كلية الحاسبات وتقنية المعلومات > المنتدى العام لكلية الحاسبات وتقنية المعلومات
التسجيل مشاركات اليوم البحث
   
   


المنتدى العام لكلية الحاسبات وتقنية المعلومات قسم خاص بالمواد العامة و الطلاب غير المتخصصين بكلية الحاسبات وتقنية المعلومات

}{ تعالو نفهم بعض الsheet }{....برمجة 2

المنتدى العام لكلية الحاسبات وتقنية المعلومات

إضافة رد
 
أدوات الموضوع إبحث في الموضوع انواع عرض الموضوع
منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
  #1  
قديم 01-03-2012, 08:25 PM
الصورة الرمزية sodelicious

sodelicious sodelicious غير متواجد حالياً

سترك يارب

 
تاريخ التسجيل: Feb 2010
التخصص: مؤجل حتى نهاية الترم
نوع الدراسة: إنتظام
المستوى: الرابع
الجنس: أنثى
المشاركات: 147
افتراضي رد: }{ تعالو نفهم بعض الsheet }{....برمجة 2


ياجماعة في احد حل سؤال اللاب التاني؟؟
Modify class GradeBook (Fig. L 3.3). Include a second String instance variable that represents the name of the course’s instructor. Provide a set method to change the instructor’s name and a get method to retrieve it. Modify the constructor to specify two parameters—one for the course name and one for the instructor’s name. Modify method displayMessage such that it first outputs the welcome message and course name, then outputs "This course is presented by: " followed by the instructor’s name. Modify the test application (Fig. L 3.4) to demonstrate the class’s new capabilities.
كود:
package lab2;

// Lab 2: GradeBook.java
// GradeBook class with a constructor to initialize the course name.

public class GradeBook
{
private String courseName; // course name for this GradeBook
/* write code to declare a second String instance variable */
private String instructorName;
// constructor initializes courseName with String supplied as argument
public GradeBook( String name )
{
courseName = name; // initializes courseName
} // end constructor
//method to set the course name
public void setCourseName( String name )
{
courseName = name; // store the course name
} // end method setCourseName
//method to retrieve the course name
public String getCourseName()
{
return courseName;
} // end method getCourseName

public void get(String name)
{
	instructorName= name;
}

// display a welcome message to the GradeBook user
public void displayMessage()
{
// this statement calls getCourseName to get the
// name of the course this GradeBook represents
System.out.printf( "Welcome to the grade book for\n%s!\n",
getCourseName() );
/* write code to output the instructor’s name */

} // end method displayMessage

} // end class GradeBook

package lab2;

//Lab 2: GradeBookTest.java
// GradeBook constructor used to specify the course name at the
// time each GradeBook object is created.

public class GradeBookTest
{
// main method begins program execution
public static void main( String args[] )
{
//create GradeBook object
GradeBook gradeBook1 = new GradeBook(
"CS101 Introduction to Java Programming" );

gradeBook1.displayMessage(); // display welcome message

/* write code to change instructor’s name and output changes */



} // end main

} // end class GradeBookTest
رد مع اقتباس

 

إضافة رد


تعليمات المشاركة
لا تستطيع إضافة مواضيع جديدة
لا تستطيع الرد على المواضيع
لا تستطيع إرفاق ملفات
لا تستطيع تعديل مشاركاتك

BB code is متاحة
كود [IMG] متاحة
كود HTML معطلة

الانتقال السريع

 


الساعة الآن 06:44 AM


Powered by vBulletin® Version 3.8.9 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Ads Organizer 3.0.3 by Analytics - Distance Education

أن كل ما ينشر في المنتدى لا يمثل رأي الإدارة وانما يمثل رأي أصحابها

جميع الحقوق محفوظة لشبكة سكاو

2003-2023