الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

كان الله فى عون العبد .. المساعده يا أهل الخبره,مطلوب حلول مجموعة من التمارين فى كتاب C#

بدأه zizo10 في 28 مايو 2008 · 5 رد · 2,646 مشاهدة · في Microsoft Visual C#.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

أنا أدرس فى كلية التربية النوعية جامعة المنصورة - وعندنا كتاب اسمه C# How To program والكتاب ده نازل من موقع اسمه deitel.com .

هذا الكتاب يحتوي على تمارين فى آخر كل Chapter هذه التمارين أريد حلولها كي أستطيع أن أفهمها جيدا قبل موعد الامتحان يوم 16/6/2008 .

ملحوظه : أنا لا أريد حلول تمارين كل الفصول , بل أريد حلول فصول معينه فقط وهي 8-9-12-13.

وسأقوم بوضع هذه التمارين:

الفصل 8

8.3 Create a class called Complex for performing arithmetic with complex numbers. Write a

driver program to test your class.

Complex numbers have the form

realPart + imaginaryPart * i

where i is

Use floating-point variables to represent the private data of the class. Provide a constructor

that enables an object of this class to be initialized when it is declared. Provide a no-argument constructor

with default values in case no initializers are provided. Provide public methods for each

of the following:

a) Addition of two Complex numbers. The real parts are added together and the imaginary

parts are added together.

B) Subtraction of two Complex numbers. The real part of the right operand is subtracted

from the real part of the left operand and the imaginary part of the right operand is subtracted

from the imaginary part of the left operand.

c) Printing of Complex numbers in the form (a, B), where a is the real part and b is the

imaginary part.

8.4 Modify the Date class of Fig. 8.8 to perform error checking on the initializer values for instance

variables month, day and year. Also, provide a method NextDay to increment the day by

one. The Date object should always remain in a consistent state. Write a program that tests the

NextDay method in a loop that prints the date during each iteration of the loop to illustrate that the

NextDay method works correctly. Be sure to test the following cases:

a) Incrementing into the next month.

B) Incrementing into the next year.

8.5 Create a class TicTacToe that will enable you to write a complete program to play the

game of Tic-Tac-Toe. The class contains as private data a 3-by-3 double array of characters. The

constructor should initialize the empty board to all spaces, ' '. Allow two players. Wherever the

first player moves, place an 'X' in the specified square; place an 'O' wherever the second player

moves. Each move must be to an empty square. After each move, determine whether the game has

been won or if the game is a draw via a GameStatus method. [Hint: use an enumeration constant

to return the following statuses: WIN, DRAW, CONTINUE.] Write Windows Application TicTac-

ToeTest to test your class. If you feel ambitious, modify your program so that the computer makes

the moves for one of the players automatically. Also, allow the player to specify whether he or she

wants to go first or second. If you feel exceptionally ambitious, develop a program that will play

three-dimensional Tic-Tac-Toe on a 4-by-4-by-4 board [Note: This is a challenging project that could

take many weeks of effort!]

8.6 Create a Date class with the following capabilities:

a) Output the date in multiple formats such as

MM/DD/YYYY

June 14, 2001

DDD YYYY

B) Use overloaded constructors to create Date objects initialized with dates of the formats

in part a).

8.7 Create class SavingsAccount. Use static variable annualInterestRate to store

the interest rate for all account holders. Each object of the class contains a private instance variable

savingsBalance indicating the amount the saver currently has on deposit. Provide method

CalculateMonthlyInterest to calculate the monthly interest by multiplying the savingsBalance

by annualInterestRate divided by 12; this interest should be added to savingsBalance.

Provide a static method ModifyInterestRate that sets the

annualInterestRate to a new value. Write a driver program to test class SavingsAccount.

Instantiate two savingsAccount objects, saver1 and saver2, with balances of $2000.00 and

$3000.00, respectively. Set annualInterestRate to 4%, then calculate the monthly interest and

print the new balances for each of the savers. Then set the annualInterestRate to 5% and calculate

the next month’s interest and print the new balances for each of the savers.

8.8 Write a console application that implements a Square shape. Class Square should contain

an instance property Side that has get and set accessors for private data. Provide two constructors:

one that takes no arguments and another that takes a side length as a value. Write an application

class that tests class Square’s functionality.

الفصل 9

9.3 Many programs written with inheritance could be written with composition instead, and vice

versa. Rewrite classes Point3, Circle4 and Cylinder to use composition, rather than inheritance.

After you do this, assess the relative merits of the two approaches for both the Point3,

Circle4, Cylinder problem, as well as for object-oriented programs in general. Which approach

is more natural, why?

9.4 Some programmers prefer not to use protected access because it breaks the encapsulation

of the base class. Discuss the relative merits of using protected access vs. insisting on using private

access in base classes.

9.5 Rewrite the case study in Section 9.5 as a Point, Square, Cube program. Do this two

ways—once via inheritance and once via composition.

9.6 Write an inheritance hierarchy for class Quadrilateral, Trapezoid, Parallelogram,

Rectangle and Square. Use Quadrilateral as the base class of the hierarchy. Make

the hierarchy as deep (i.e., as many levels) as possible. The private data of Quadrilateral

should be the x-y coordinate pairs for the four endpoints of the Quadrilateral. Write a program

that instantiates objects of each of the classes in your hierarchy and polymorphically outputs each object’s

dimensions and area.

9.7 Modify classes Point3, Circle4 and Cylinder to contain destructors. Then, modify

the program of Fig. 9.19 to demonstrate the order in which constructors and destructors are invoked

in this hierarchy.

9.8 Write down all the shapes you can think of—both two-dimensional and three-dimensional—

and form those shapes into a shape hierarchy. Your hierarchy should have base class Shape from

which class TwoDimensionalShape and class ThreeDimensionalShape are derived. Once

you have developed the hierarchy, define each of the classes in the hierarchy. We will use this hierarchy

in the exercises of Chapter 10 to process all shapes as objects of base-class Shape. (This is a

technique called polymorphism.)

الفصل 12

12.3 Extend the program in Fig. 12.24 to include a CheckBox for every font style option. [Hint:

Use XOR rather than testing for every bit explicitly.]

12.4 Create the GUI in Fig. 12.33. You do not have to provide any functionality.

12.5 Create the GUI in Fig. 12.34. You do not have to provide any functionality.

12.6 Extend the program of Fig. 12.30 to include options for changing the size and color of the

lines drawn. Create a GUI similar to the one in Fig. 12.35. [Hint: Have variables to keep track of the

currently selected size (int) and color (Color object). Set them using the event handlers for the radio

buttons. For the color, use the various Color constants (such as Color.Blue). When responding

to the mouse moves, simply use the size and color variables to determine the proper size and

color.]

12.7 Write a program that plays “guess the number” as follows: Your program chooses the number

to be guessed by selecting an integer at random in the range 1–1000. The program then displays

the following text in a label:

I have a number between 1 and 1000—can you guess my number?

Please enter your first guess.

A TextBox should be used to input the guess. As each guess is input, the background color should

change to either red or blue. Red indicates that the user is getting “warmer,” and blue indicates that

the user is getting “colder.” A Label should display either “Too High” or “Too Low” to help the

user choose a number closer toward the correct answer. When the user obtains the correct answer,

“Correct!” should be displayed. The background should become green and the TextBox used

for input should become uneditable. Provide a Button that allows the user to play the game again.

When the Button is clicked, generate a new random number, change the background to the default

color and generate the input TextBox to editable.

الفصل 13

13.3 Write a program that displays the names of 15 states in a ComboBox. When an item is selected

from the ComboBox, remove it.

13.4 Modify your solution to Exercise 13.3 to add a ListBox. When the user selects an item

from the ComboBox, remove the item from the ComboBox, and add it to the ListBox. Your program

should check to ensure that the ComboBox contains at least one item. If it does not, print a message

in a message box, and terminate program execution.

13.5 Write a program that allows the user to enter strings in a TextBox. Each string input is added

to a ListBox. As each string is added to the ListBox, ensure that the strings are in sorted order.

Any sorting method may be used.

13.6 Create a file browser (similar to Windows Explorer) based on the programs in Fig. 13.7,

Fig. 13.21 and Fig. 13.24. The file browser should have a TreeView, which allows the user to

browse directories. There should also be a ListView, which displays the contents (all subdirectories

and files) of the directory being browsed. Double-clicking a file in the ListView should open

it, and double-clicking a directory in either the ListView or the TreeView should browse it. If a

file or directory cannot be accessed, because of its permission settings, notify the user.

13.7 Create an MDI text editor. Each child window should contain a multiline TextBox. The

MDI parent should have a Format menu, with submenus to control the size, font and color of the text

in the active child window. Each submenu should have at least three options. In addition, the parent

should have a File menu with menu items New (create a new child), Close (close the active child)

and Exit (exit the application). The parent should have a Window menu to display a list of the open

child windows and their layout options.

13.8 Create a UserControl called LoginPasswordUserControl. The LoginPasswordUserControl

contains a Label (loginLabel) that displays String "Login:", a

TextBox (loginTextBox) where the user inputs a login name, a Label (passwordLabel)

that displays the String "Password:" and finally, a TextBox (passwordTextBox) where

a user inputs a password (don’t forget to set property PasswordChar to "*" in the TextBox’s

Properties window). LoginPasswordUserControl must provide public read-only properties

Login and Password that allow an application to retrieve the user input from loginTextBox

and passwordTextBox. The UserControl must be exported to an application that displays the

values input by the user in LoginPasswordUserControl.

وأذكركم وأقول لكم : كان الله فى عون العبد ما دام العبد فى عون أخيه . ولكم جزيل الشكر ,,,,

#2

أرجو منكم الرد بسرعه على موضوعي ولو حتى بعدم وجود الإجابات .

شكرا

#3

اصلا الموضوع مخالف

/index.php?showtopic=29343

نموت وتحيا ...................فلسطين .

#4

اتتوقع ان نقرأ كل هذا

حاول ببعض الاسئلة وضع اين تواجهك مشاكل لكي نساعدك

الله معك ..

#5

هو انت اللى كاتب الموضوع يا اخ على

#6

فى الوقت اللى كتبت فيه الكلام ده كان ممكن تدور على حلول وبعدين اول مره اعرف انهم فى كلية التربية النوعيه بياخدوا سى شارب

وفى جامعة المنصورة تحت علم بلد اليمن

الموضوع مخالف يا زيزو

مواضيع مشابهة

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…