عرض مشاركة واحدة
منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 16-11-2013, 07:44 PM   #1068

ميج حمدان

لا حولَ ولا قوة الا بالله

الصورة الرمزية ميج حمدان

 
تاريخ التسجيل: Sep 2013
التخصص: حاسب آلي
نوع الدراسة: إنتظام
المستوى: الأول
الجنس: أنثى
المشاركات: 11
افتراضي رد: [cpcs 202 - برمجة 1] لديك سؤال , شيء غير مفهوم ,,, تفضل هنا , موضوع مفيد

ممكن مساعدة في حل Activities الي تتكلم عن if لاني مو مستوعبتها مرة :"(

Activity1: Assume that x is 1, show the result of the following Boolean expressions as true or false:


!(x > 0) && (x > 0)
(x > 0) || (x < 0)
(x != 0) || (x == 0)
(x >= 0) || (x < 0)
(x != 1) == !(x == 1)

Activity2: Write a Boolean expression that evaluates to true if a number stored in variable num is between 1 and 100.


Activity3: (a) Write an if statement that increases pay by 3% if score is greater than 90.

(b) Write an if statement that increases pay by 3% if score is greater than 90, otherwise increases pay by 1%.


Activity 5: Use application Grade for Exercises 1, 2, and 3.

// Application Grade prints appropriate messages on System.out
// based on a grade read from the keyboard
import java.util.Scanner;
public class Grade
{
public static void main(String[] args)
{
int grade;
Scanner inData = new Scanner(System.in):
System.out.println("Key in an integer grade. ");
grade = inData.nextInt();
if
// TO BE FILLED IN

}
}

Exercise 1: When completed, application Grade reads an integer value and writes an appropriate message on System.out. Complete the if statement so that “Congratulations!” is written if the numeric grade is greater than or equal to 80. Run the program five times entering the following values for grade: 60, 100, 80, 81, and 79.
“Congratulations!” is printed ___________ time(s) in the five runs.
Exercise 2: Change the Boolean expression in Exercise 1 so that “Try harder” is printed if the numeric grade is less than 70. Run the program with the same data listed for Exercise 1.
“Try harder” is printed ___________ time(s) in the five runs.
Exercise 3: Change the Boolean expression so that “Average” is printed if the numeric grade is less than 80 but greater than 70. Run the program with the same data listed for Exercise 1.
“Average” is printed___________ time(s) in the five runs.

 

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