السلام عليكم ورحمة الله وبركاتة يا اخواني الاعزاء
في الحقيقة كنت احاول في حل بعض الاسلئة المتعلقة ببرمجة بلغة الجافا.معظم الاسلئة تمكنت من حلها ولكني واجهت صعوبه في سؤالين.وحاولت ان احلهن ولكني عجرت.فقلت سوف الجأ الى اخواني لعلهم لديهم فكرة عنهما.لاني ما بدت اتعلم الجافا من فترة بسيطة واحسها لغة صعبة ومعقدة تحتاج الى معلم يدرسك. ولك جزيل الشكر مقدماا
السؤال الأول:
<H1 style="MARGIN: 12pt 0in 3pt">Program #1 – Trees</H1><H3 style="MARGIN: 12pt 0in 3pt">DETAILS</H3>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.
<H3 style="MARGIN: 12pt 0in 3pt">REQUIREMENTS</H3>· 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”).
السؤال الثاني:
<H1 style="MARGIN: 12pt 0in 3pt">Program #2 – Water Bill</H1><H3 style="MARGIN: 12pt 0in 3pt">DETAILS</H3>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.
والله ولي التوفيق
