Create a program named paintingdemo

Assignment Help C/C++ Programming
Reference no: EM133201514

This Assignment Description contains three programming assignments. Below are the programming assignments from the concepts learnt. Each assignment has a problem description, and you are required to discussion, to be complete / to solve the problem. 

Programming Assignment 1

Write a program named SalespersonDemo that instantiates objects using classes named RealEstateSalesperson and GirlScout. Demonstrate that each object can use a SalesSpeech() method appropriately. Also, use a MakeSale() method two or three times with each object, and display the final contents of each object's data fields. First, create an abstract class named Salesperson. Fields include first and last names; the Salesperson constructor requires both these values. Include properties for the fields. Include a method that returns a string that holds the Salesperson's full name-the first and last names separated by a space. Then perform the following tasks:

  • Create two child classes of Salesperson: RealEstateSalesperson and GirlScout. The RealEstateSalesperson class contains fields for total value sold in dollars and total commission earned (both of which are initialized to 0), and a commission rate field required by the class constructor. The GirlScout class includes a field to hold the number of boxes of cookies sold, which is initialized to 0. Include properties for every field.
  • Create an interface named ISellable that contains two methods: SalesSpeech() and MakeSale(). In each RealEstateSalesperson and GirlScout class, implement SalesSpeech() to display an appropriate one- or two-sentence sales speech that the objects of the class could use.

 In the RealEstateSalesperson class, implement the MakeSale() method to accept an integer dollar value for a house, add the value to the RealEstateSalesperson's total value sold, and compute the total commission earned. In the GirlScout class, implement the MakeSale() method to accept an integer representing the number of boxes of cookies sold and add it to the total field.        

Programming Assignment 2

Create a program named PaintingDemo that instantiates an array of eight Room objects and demonstrates the Room methods. The Room constructor requires parameters for length, width, and height fields; use a variety of values when constructing the objects. The Room class also contains a field for wall area of the Room and number of gallons of paint needed to paint the room. Both of these values are computed by calling private methods. Include read-only properties to get a Room's values. A room is assumed to have four walls, and you do not need to allow for windows and doors, and you do not need to allow for painting the ceiling. A room requires one gallon of paint for every 350 square feet (plus an extra gallon for any square feet greater than 350). In other words, a 12 X 10 room with 9-foot ceilings has 396 square feet of wall space, and so requires two gallons of paint.

Programming Assignment 3

Remember, strings are immutable. Consider a string that represents a strand of DNA: string dna = " TCG-TAC-gaC-TAC-CGT-CAG-ACT-TAa-CcA-GTC-cAt-AGA-GCT". There are some typos in the string that we would like to fix:

  1. Use the Trim() method to remove the leading and trailing whitespace, and then print the results.
  2. Change all of the letters in the dna string to UPPERCASE and print the result.
  3. Note that if you try Console.WriteLine(dna) after applying the methods, the original, flawed string is displayed. To fix this, you need to reassign the changes back to dna. Apply these fixes to your code so that Console.WriteLine(dna) prints the DNA strand in UPPERCASE with no whitespace.

Let's use string methods to do more work on the DNA strand:

  1. Replace the sequence "GCT" with 'AGG', and then print the altered strand.
  2. Look for the sequence "CAT" with IndexOf(). If found print, "CAT found", otherwise print, "CAT NOT found".
  3. Use Substring() to print out the fifth set of 3 characters (called a codon) from the DNA strand.
  4. Use string interpolation to print, "The DNA strand is ___ characters long.

If we want to turn the string "C Sharp" into "CS", we might try .Remove(). Too easy. Let's use our cleverness to achieve the same result and practice with other C# methods.

  1. Use string concatenation and two Substring() methods to print "CS" from "C Sharp".
  2. Without using Substring(), use method chaining to accomplish the same thing.
  3. Use bracket notation and string interpolation to print, "The abbreviation for "C Sharp" is "CS." Don't forget about your escape characters.

Reference no: EM133201514

Questions Cloud

Dispute over the profits arises, and ultimately a court : LAW 100 Strayer University and How could this dispute have been avoided in the first place - What will be the result?
Define health behavior explain public health significance : Define the health behavior explain the public health significance of the health behavior (e.g., prevalence, population, morbidity, mortality)
What are the main ways to segment markets : What are the main ways to segment markets? Doing it internationally can be difficult. What are the things you need to keep in mind when doing so?
Should be tackled with break-even analysis : Explain why pricing and production are extent decisions and not decisions that should be tackled with break-even analysis.
Create a program named paintingdemo : This Assignment Description contains three programming assignments. Below are the programming assignments from the concepts learnt. Each assignment has a proble
What autotrophs need for photosynthesis : Moraine Valley Community College-By now you should know what our cells need for cellular respiration and what autotrophs need for photosynthesis.
Which a firm made a decision considering irrelevant costs : Explain a situation you have observed (or read about) in which a firm made a decision considering irrelevant costs.
Evolutionary Taxonomy and Cladistic Taxonomy : BIO 120-Grossmont College-What is taxonomy? Think about whether mosses have vascular tissue or not.
What was the most challenging aspect of the project : What was the most challenging aspect of the project? What will you do differently next time? What did you understand that you not know before completing project

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a program that asks the user to enter a latitude

Write a program that asks the user to enter a latitude in degrees, minutes, and seconds and that then displays the latitude in decimal format.

  Dynamicword.h contains a class definition

Consider the following main function.  Assume that DynamicWord.h contains a class definition for a class called DynamicWord that holds a pointer to a dynamic array as a private data member, but the assignment operator (=) has not been overloaded for ..

  Program to decode a secret message

Write a program that decodes a message that was encoded using a random key. These keys work similar to a magic decoder wheel (where 'A' encodes to 'F', 'B' encodes to 'G', 'C' encodes to 'H', etc)except there is a random mapping from one letter to..

  Write a program to create 100 real random numbers

Write a program to create 100 real random numbers and store it into a 1-D array. Find the value 1413 from the stored data and print out the value 1413 and the index of the array to the screen

  Create your own eclipse java project and filereverserxw

Review the attached Javadoc (unzip the file and open the index.html file in a browser), and class UML diagram. These are from the project in the video, so should be clear how the implementation proceeds. Create your own Eclipse Java project, FileR..

  Role of a parameterized type in function templates

What is the role of a parameterized type in function templates? May I have an example that illustrates specifying a parameterized type for a function template.

  To use a sentinel loop so once the value of -99 i

modify this program to use a sentinal loop so once the value of -99 is entered after getting the pay and hours the program should end.

  How does a sequential file work

How does a sequential file work? Provide an example. Provide C++ code that opens, reads, and then closes a sequential file

  Create an array of class money

Create an array of class money to get at least 5 different amounts and call convert() function for each array element.

  Implement a class address

A theater seating chart is implemented as a two-dimensional array of ticket prices like presented below. Write a program that prompts the users to pick either a seat or a price. Mark sold seats by changing the price to zero.

  Execute a program that requires sequential files

Build, and execute a program that requires sequential files to make address database - Demonstrate entering, appending, storing, and retrieving records

  Write a gui program in graphics class to draw a smiley face

Write a GUI program that uses the methods in the Graphics class to draw a smiley face when the window is activated, and a frowny face when the window.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd