New Semester
Started
Get
50% OFF
Study Help!
--h --m --s
Claim Now
Question Answers
Textbooks
Find textbooks, questions and answers
Oops, something went wrong!
Change your search query and then try again
S
Books
FREE
Study Help
Expert Questions
Accounting
General Management
Mathematics
Finance
Organizational Behaviour
Law
Physics
Operating System
Management Leadership
Sociology
Programming
Marketing
Database
Computer Network
Economics
Textbooks Solutions
Accounting
Managerial Accounting
Management Leadership
Cost Accounting
Statistics
Business Law
Corporate Finance
Finance
Economics
Auditing
Tutors
Online Tutors
Find a Tutor
Hire a Tutor
Become a Tutor
AI Tutor
AI Study Planner
NEW
Sell Books
Search
Search
Sign In
Register
study help
computer science
systems analysis design
C# Programming From Problem Analysis To Program Design 4th Edition Barbara Doyle - Solutions
Write an application that calculates a student’s GPA on a 4.0 scale. Grade point average (GPA) is calculated by dividing the total amount of grade points earned by the total amount of credit hours attempted. For each hour, an A receives 4 grade points, a B receives 3 grade points, a C receives 2
Prompt the user for the length of three line segments as integers. If the three lines could form a triangle, print the integers and a message indicating they form a triangle. Use a state-controlled loop to allow users to enter as many different combinations as they want.
Write a program that produces a multiplication table with 25 rows of computations.Allow the user to input the first and last base values for the multiplication table. Display a column in the table beginning with the first base inputted value. The last column should be the ending base value
Write an application that will enable a vendor to see what earnings he can expect to make based on what percentage he marks up an item. Allow the user to input the wholesale item price. In a tabular form, show the retail price of the item marked up at 5%, 6%, 7%, 8%, 9% and 10%.
Write a program that allows the user to input any number of hexadecimal characters. Sum the values and display the sum as a hexadecimal value. Within the loop, convert each character entered to its decimal equivalent. Treat each single inputted character as a separate value. Display the original
Create an application that determines the total due including sales tax and shipping. Allow the user to input any number of item prices. Sales tax of 7.75% is charged against the total purchases. Shipping charges can be determined based on the number of items purchased. Use the following chart to
Write a program to calculate the average of all scores entered between 0 and 100.Use a sentinel-controlled loop variable to terminate the loop. After values are entered and the average calculated, test the average to determine whether an A, B, C, D, or F should be recorded. The scoring rubric is as
Create an application that contains a loop to be used for input validation.Valid entries are positive integers less than 100.Test your program with values both less than and greater than the acceptable range as well as non-numeric data. When the user is finished inputting data, display the number
To access an array element, use an index enclosed in square brackets.
To produce the output 2 4 6 8 10 which should be the loop conditional expression to replace the question marks?int n = 0;do{n = n + 2;Console.Write("{0}\t", n);} while (????);a. n < 11b. n < 10c. n < 8d. n > = 2e. n > 8
If aValue, i, and n are type int variables, what does the following program fragment do?aValue = 0; n = 10;for (i = n; i > 0; i--)if (i % 2 == 0)aValue = aValue + i;a. computes the sum of the integers from 1 through nb. computes the sum of the integers from 1 through n - 1c. computes the sum of the
With the do. . .while posttest loop structure, the statements are executed once before the conditional expression is tested.
The foreach statement is new and is used to iterate or move through a collection, such as an array. It does not require a loop control variable to be incremented and tested to determine when all data has been processed.
The for statement is considered a specialized form of the while statement.It packages together the initialization, test, and update—all on one line.
A state-controlled loop, also referred to a flag-controlled loop, uses a special variable—not the variable used to store the data that is being processed. With a state-controlled loop, the body of the loop is stopped when the special variable’s value is changed.
The MessageBox.Show( ) method is used to display information to users in a format that resembles Windows applications.
Sentinel-controlled loops are also referred to as indefinite loops. They are useful when the number of repetitions is not known before the loop’s execution.For interactive input, a sentinel value is selected and the user is told to input that value to stop. The sentinel value should not be
With counter-controlled loops, it is important to think through test cases and check endpoints to ensure they have been used to avoid off-by-one errors.
An infinite loop does not have provisions for normal termination. Infinite loops occur when the loop’s conditional expression never evaluates to false or there is some inherent characteristic or problem with the loop.
When you know the number of times the statements must be executed, you can use a counter-controlled loop.
The looping structures available in C# include while, do. . .while, for, and foreach statements. The do. . .while loop is a posttest. The others are pretest loop structures. With pretest, the conditional expression is tested before any of the statements in the body of the loop are performed.
Based on a predetermined condition, iteration enables you to identify and block together one or more statements to be repeated.
The three programming constructs found in most programming languages are simple sequence, selection, and iteration.
A loop can be included within the body of another loop. When this occurs, the innermost nested loop is completed totally before the outside loop is tested a second time.
C# offers a number of jump statements that can alter the flow of control in a program. They include break, continue, goto, throw, and return statements.
What would be the output produced from the following statements?int aValue = 1;do{aValue++;Console.Write(aValue++);} while (aValue < 3);a. 23b. 234c. 1234d. 2e. none of the above
Which of the following for statements would be executed the same number of times as the following while statement?int num = 10;while(num > 0){Console.WriteLine(num);num--;}a. for (num = 0; num < 10; num++)b. for (num = 1; num < 10; num++)c. for (num = 100; num == 10; num+=10)d. for (num = 10; num <
Which of the following is a valid C# pretest conditional expression that enables a loop to be executed as long as the counter variable is less than 10?a. do while (counter < 10)b. while (counter < 10)c. foreach (counter in 10)d. none of the abovee. all of the above
When used with a while statement, which jump statement causes execution to halt inside a loop body and immediately transfers control to the conditional expression?a. breakb. gotoc. returnd. continuee. none of the above
If a loop body uses a numeric value that is incremented by three with each iteration through the loop until it reaches 1000, which loop structure would probably be the best option?a. foreachb. forc. whiled. do. . .whilee. none of the above
If a loop body must be executed at least once, which loop structure would be the best option?a. foreachb. forc. whiled. do. . .whilee. none of the above
Which loop structure can only be used with a collection or array?a. foreachb. forc. whiled. do. . .whilee. none of the above
To write a sentinel-controlled loop to compute the average temperature during the month of July in Florida, the best option for a sentinel value would be:a. 67b. 1000c. 100d. ‘‘high temperature’’e. none of the above
Loops are needed in programming languages:a. to facilitate sequential processing of datab. to enable a variable to be analyzed for additional processingc. to process files stored on hard drivesd. to allow statements to be repeatede. all of the above
Regarding decisions about which type of loop to use—if you know your loop will always be executed at least once, then do. . .while is a good option.When a numeric variable is being changed by a consistent amount with each iteration through the loop, the for statement might be the best option. The
The break and continue statements should be used sparingly with loops.
When a continue statement is reached, it starts a new iteration of the nearest enclosing while, do. . .while, for, or foreach loop statement.
The Control class has a number of methods, including Focus( ), Hide( ), Select( ), and Show( ).
With the following declaration:int [ , ] points = {{300, 100, 200, 400, 600},{550, 700, 900, 200, 100}};The statement points[0, 4] = points[0, 4-2]; willa. replace the 400 amount with 2b. replace the 300 and 600 with 2c. replace the 600 with 200d. result in an errore. none of the above
Write an application that creates a two-dimensional array. Allow the user to input the size of the array (number of rows and number of columns). Fill the array with random numbers between the 0 and 100.Search the array for the largest value. Display the array values, numbers aligned, and the
Write a program that creates a two-dimensional array with 10 rows and 2 columns. The first column should be filled with 10 random numbers between 0 and 100.The second column should contain the squared value of the element found in column 1.. Using the Show( ) method of the MessageBox class, display
reAay ouyay aay hizway ithway igPay atin?Lay? (Translated: ‘‘Are you a whiz with Pig Latin?’’) Write a program that converts an English phrase into a pseudo-Pig Latin phrase (that is Pig Latin that doesn’t follow all the Pig Latin syntax rules). Use predefined methods of the Array and
Write an application that displays revenue generated for exercise classes at the Tappan Gym. The gym offers two types of exercise classes, zumba and spinning, six days per week, four times per day. Zumba is offered at 1, 3, 5, and 7 p.m.; spinning is offered at 2, 4, 6, and 8 p.m. When attendees
Write an application that enables you to randomly record water depths for 5 different locations at 0700 (7 a.m.), 1200 (noon), 1700 (5 p.m.), and 2100(9 p.m.). The locations are Surf City, Solomons, Hilton Head, Miami, and Savannah. For ease of input, you may want to code the locations (i.e., Surf
Console applications and Windows applications interact differently with the operating system. With console applications, the program calls on the operating system to perform certain functions such as inputting or outputting of data.In contrast, Windows applications are event driven. They register
An event is a notification from the operating system that an action has occurred, such as the user clicking the mouse or pressing a key on the keyboard.
With Windows applications, you write methods called event handlers to indicate what should be done when an event such as a click on a button occurs.
Another important difference in a Windows application is that unlike the sequential nature you can plan on with console-based applications, in which one statement executes and is followed by the next, no sequential order exists with event-handling methods for Windows applications.
As the front end of a program, the interface is the visual image you see when you run a program. Windows applications not only function differently from console applications, they look different, and can, therefore, be used to create a friendlier user interface.
Windows-based GUI applications are displayed on a Windows form. Form is a container waiting to hold additional controls, such as buttons or labels.Controls are objects that can display and respond to user actions.
The Visual Studio integrated development environment (IDE) automatically generates for you all the code needed for a blank Windows form. The amount of development time for Windows applications is greatly reduced when you use Visual Studio and C#, because it is easy to add controls by dropping and
When you have a class defined that has the class name, followed by a colon and then another class name, you have inheritance. The second class is called the base class; the first is called the derived class. The derived class inherits the characteristics of the base class. In C# and all .NET
Your design should take into consideration the target audience. Use consistency in the design unless there is a reason to call attention to something.Alignment should be used to group items. Avoid clutter and pay attention to color.
Properties of the Form class include AutoScroll, BackColor, Font, ForeColor, Location, MaximizeBox, Size, StartPosition, and Text. Text is used to set the caption for the title bar of the form.
A preprocessor directive indicates that something should be done before processing. C# does not have a separate preprocessing step. The #region preprocessor directive in C# is used to explicitly mark sections of source code that you can expand or collapse.
The System.Windows.Forms namespace includes many classes representing controls with names such as Button, Label, TextBox, ComboBox, MainMenu, ListBox, CheckBox, RadioButton, and MonthCalendar that you can add to your form. Each comes with its own bundle of predefined properties and methods, and
Write a program that allows the user to enter any number of names. Your prompt can inform the user to input their first name followed by a space and last name. Order the names in ascending order and display the results with the last name listed first, followed by a comma and then the first name. If
Write a two class application that creates a customer code to be placed on a mailing label for a magazine. Allow the user to input their full name with the first name entered first. Prompt them to separate their first and last name with a space.Ask for their birthdate in the format of mm/dd/yyyy.
Revise your solution for problem 2 so that you display the total sales per salesman.Place the first and last names for the salesmen in an array. Write your solution so that any number of salesmen and any number of products can be displayed. When you display your final output, print the salesman’s
With the following declaration:int [ , ] points = {{300, 100, 200, 400, 600},{550, 700, 900, 200, 100}};The statement Console.Write(points[1, 2] + points[0, 3]); willa. display 900400b. display 1300c. display "points[1, 2] + points[0, 3]"d. result in an errore. none of the above
When you pass an element from an ArrayList to a method, the method receives:a. a copy of the ArrayListb. the address of the ArrayListc. a copy of the value in the element of the ArrayListd. the address of the element in the ArrayListe. none of the above
When you pass the entire ArrayList to a method, the method receives:a. a copy of the ArrayListb. the address of the ArrayListc. a copy of the first value in the ArrayListd. the address of each of the elements in the ArrayListe. none of the above
To convert all the uppercase letters in a string to their lowercase counterpart, you can use the method of the string class.a. IsLower( )b. ConvertLower( )c. Lower( )d. ToLower( )e. none of the above
Which method in the ArrayList class can be used to place a value onto the end of the ArrayList?a. AddLast( )b. AddLastIndex( )c. Add( )d. Insert( )e. none of the above
Which method in the ArrayList class can be used to get or set the number of elements that an ArrayList can contain?a. Length( )b. Size( )c. Dimension( )d. Rank( )e. Capacity( )
Which class includes methods to create a dynamic one-dimensional structure?a. Arrayb. stringc. arrayd. ArrayListe. all of the above
A correct method call to a method that has the following heading would be:int result(int[ , ] anArray, int num)a. Console.Write(result(anArray, 3));b. result(anArray, 30);c. Console.Write(result(anArray[ ], 3));d. result(anArray[ ], 30);e. none of the above
With two-dimensional arrays a limitation on the foreach statement is that it can:a. only be used for read-only accessb. only be used with integral type arraysc. not be used with multidimensional arraysd. only be used with arrays smaller than 1000 elementse. not be used with dynamic arrays
In order to retrieve a value stored in an object of the Queue class, you would use which method?a. Pop( );b. Push( );c. Dequeue( );d. Enqueue( );e. none of the above
Use the following string to answer questions a through e.string sValue = "Today is the first day of "+ "the rest of your life."a. Create a new string that has all lowercase characters except the word day. Day should be all uppercase.b. Create a new string array that contains the eight elements.
Using the following declaration:int [ , ] anArray = {{34, 55, 67, 89, 99}, {22, 68, 11, 19, 45}};What would be the result of each of the following output statements?a. Console.WriteLine(anArray.Length);b. Console.WriteLine(anArray[1, 2]);c. Console.WriteLine(anArray[0, anArray.GetLength(0) - 2]);d.
Using the following declarations, write solutions for Steps a through e.int [ , ] cArray = new int [2, 3];string [ , , ] dArray = new string [5, 2, 6];a. Write a foreach loop to display the contents of cArray.b. Write a for loop to increment each element in cArray by 5.c. Write a foreach loop to
Create array declarations for the following problem specifications.a. An array to hold the name of the largest 3 cities for 5 states. Initialize with the 5 states closest to your campus.b. A single array to hold the names of 10 people. You should be able to reference each person’s first name
Explain the difference between the .NET Hashtable and Dictionary classes.
Write an application that creates and returns a one-dimensional array containing all the elements in the two-dimensional array. Store the values in a row major format. For testing purposes, you may do a compile-time initialization of a 12 x 5 two-dimensional array. Display both the two-dimensional
Write an application that will let you keep a tally of how well three salesmen are performing selling five different products. You should use a two-dimensional array to solve the problem. Allow the user to input any number of sales amounts.Do a compile-time initialization of the salesperson’s
The Control class has a number of properties, including Anchor, BackColor, Enabled, Font, ForeColor, Location, Name, Size, TabIndex, Text, and Visible. Names of properties are quite intuitive.
Controls that you add to a form are objects or instances of one of the predefined classes such as Label, TextBox, and Button. They inherit the properties, methods, and events from the Control class.
Which of the following design considerations leads to more user-friendly presentation layers for GUIs?a. Avoid clutter.b. Be consistent with font, color, and placement.c. Design for the target audience.d. Use contrast to call attention to something.e. all of the above
The #region #endregion is an example of a C# .a. Windows class declaration statementb. required statement for creating Windows applicationsc. reference to a namespace called regiond. preprocessor directivee. collapsible segment of code that must be used for Windows applications
During design, how can you separate the business logic from the presentation layer?a. Create two forms, one for input and the other for output.b. Create two objects using an object-oriented approach.c. Create at least two methods.d. Create separate classes for each.e. all of the above
Describe at least three ways Windows applications differ from console applications.
Identify which property could be set so that a Form object would perform the following function:a. Change the background color for the form.b. Set the default font to Courier for all controls that are added.c. Change the size of the window to 400 by 400.d. Associate a name of designForm with the
Describe what might be done to respond to a button click event.
List at least five issues to consider when you plan the design of graphical user interfaces.
Describe the process that must occur to get a TextBox object added to a Form object. In your description, consider not only how the process is performed with Visual Studio, but also what steps would be necessary to do it manually.
Create a Windows application that can be used to input a user’s name. Include an appropriate label indicator for the name and a textbox for the input entry.A button labeled OK should retrieve and display the value entered on another label positioned near the bottom of the form. The font color for
Create a Windows application that can be used to change the form color. Your form background color should initially be blue. Provide at least two buttons with two different color choices. Change the font style and size on the buttons. Align the buttons so that they are in the center of the form.
Create a Windows application that contains two textboxes (with labels) and one button. The textboxes should be used to allow the user to input the x- and ycoordinates to indicate where the form should be positioned. When the user clicks the button, the window should be moved to that new point. Be
Create a Trip Calculator Windows application that can be used to determine miles per gallon for a given trip. Set the Form object properties of Name, ForeColor, BackColor, Size, Location, Text, and AcceptButton. The form should contain labels and textboxes to allow the user to input trip
Create a Windows application that contains two textboxes and two buttons. The textboxes should be used to allow the user to input two positive numeric values.The buttons should be labeled Add and Multiply. Create event-handler methods that retrieve the values, perform the calculations, and display
Create a Windows application that contains a textbox for a person’s name. Plan that the user may enter only first and last name, or they may enter first, middle, and last names. Include labels to store first, middle, and last names. A button should be included. When the button is clicked,
Create a Windows application that contains two textboxes and three buttons. One of the textboxes and one of the buttons are initially invisible. The first textbox should be used to input a password. The textbox should be masked to some character of your choosing so that the characters entered by
Create a Windows application that can be used to determine distance traveled given speed and time. Recall that distance = speedtime provide textboxes for time and speed and a button to calculate to the distance. Be sure only numeric data is able to be entered into the textboxes. Experiment with
Create a Windows application that functions like a banking account register.Separate the business logic from the presentation layer. The graphical user interface should allow the user to input the account name, number, and balance.Provide textbox objects for withdrawals and deposits. A button
Which of the following might be the heading for an event-handler method?a. private void btn1_Click(object sender, System.EventArgs e)b. Application.Run(new TempAgencyForm());c. btnCalculate.Click += new System.EventHandler(this.btnCalculate_Click);d. this.btnCalculate = new
The property of the TextBox control that is used to set all characters to uppercase as they are typed is:a. CharacterCasingb. Textc. ToUpperd. UpperCasee. ConvertToUpper
The statement that registers a Button object click event with the operating system is:a. this.button1ClickEvent = new System.Windows.Forms.Button( );b. private System.Windows.Forms.Button button1ClickEvent;c. this.Controls.AddRange(this.button1ClickEvent);d. button1.Click = "Register Me";e.
Label objects are normally used to provide descriptive text for another control. In addition to the inherited members, they have their own unique properties, methods, and events.
TextBox objects are probably the most commonly used controls, because they can be used for both input and output. In addition to the inherited members, they have their own unique properties, methods, and events.
Showing 900 - 1000
of 5433
First
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Last
Step by Step Answers