hopeless58
18-10-2008, 02:26 PM
السلام وعليكم ورحمة الله وبركاتة يا اخوان
في الحقيقة انا ليس لدي اي خبرة في الجاف ولكني احاول ان اثقف نفسي لكي اتعلم هذة اللغة وهنا لدي سؤالين حاولت ان احلهما ولكني لم استطع لاني ليس لدي اي فكرة عن طريقة الحل ولذلك لم اجد حلاا الا ان التجأ لكم يا ااعزائي ولكم جزيل الشكر
السؤال الأول:
Program #1 – Trees
DETAILS
Write a program with a class named Trees contains the main() method which defines String variables. These variables are used with println() statements to display a design of repeating geometric shapes to the screen. Full credit requires a printout that matches the sample.
REQUIREMENTS
· One variable could be used for each printed line but you should think of a way to avoid duplicating variables with the same value! The sample used eight variables can you figure out how it was done?
· You should enlarge the “compiler output” window to have a better view of your program output and best debug it.
· The program should use no more than four “println()” statements. Though, it can all be done in one “println()” statement (Hint: think of “\n”).
السؤال الثاني
Program #2 – Water Bill
DETAILS
Write a program with one class named WaterBill that will prompt the user for the starting and ending readings from the water meter. DO NOT use any magic numbers (literal constants) in your expression! Any literals MUST be defined as final variables (i.e CONSTANTS). We will do this calculation in main() because you haven’t had the material concerning methods and their return values yet. Without method return values it becomes very difficult to write all but the simplest of object-oriented programs.
REQUIREMENTS:
· Initialize all variables to an initial value when you declare them.
· Use constants for all values that do not change
· The formula for calculating the water bill is:
cost = C + (gallons * U)
U represents the charge of $1.12 per 1000 gallons delivered.
C represents the minimum delivery charge of $12.00.
· The average monthly cost is the total quarterly cost divided by 3.
في الحقيقة انا ليس لدي اي خبرة في الجاف ولكني احاول ان اثقف نفسي لكي اتعلم هذة اللغة وهنا لدي سؤالين حاولت ان احلهما ولكني لم استطع لاني ليس لدي اي فكرة عن طريقة الحل ولذلك لم اجد حلاا الا ان التجأ لكم يا ااعزائي ولكم جزيل الشكر
السؤال الأول:
Program #1 – Trees
DETAILS
Write a program with a class named Trees contains the main() method which defines String variables. These variables are used with println() statements to display a design of repeating geometric shapes to the screen. Full credit requires a printout that matches the sample.
REQUIREMENTS
· One variable could be used for each printed line but you should think of a way to avoid duplicating variables with the same value! The sample used eight variables can you figure out how it was done?
· You should enlarge the “compiler output” window to have a better view of your program output and best debug it.
· The program should use no more than four “println()” statements. Though, it can all be done in one “println()” statement (Hint: think of “\n”).
السؤال الثاني
Program #2 – Water Bill
DETAILS
Write a program with one class named WaterBill that will prompt the user for the starting and ending readings from the water meter. DO NOT use any magic numbers (literal constants) in your expression! Any literals MUST be defined as final variables (i.e CONSTANTS). We will do this calculation in main() because you haven’t had the material concerning methods and their return values yet. Without method return values it becomes very difficult to write all but the simplest of object-oriented programs.
REQUIREMENTS:
· Initialize all variables to an initial value when you declare them.
· Use constants for all values that do not change
· The formula for calculating the water bill is:
cost = C + (gallons * U)
U represents the charge of $1.12 per 1000 gallons delivered.
C represents the minimum delivery charge of $12.00.
· The average monthly cost is the total quarterly cost divided by 3.