Define - implement and test a complex class

Assignment Help Programming Languages
Reference no: EM131889418

Assignment - Classes, Reference Variables and the String Class

1. Given an arbitrary ransom note, consisting of 15 - 20 words and several magazines, write a function that will return a true, if the ransom note can be constructed from the words in the magazines, otherwise it will return a false. Each word in the magazines can only be used once in your ransom note. The algorithm should work efficiently, such as, utilizing hash tables for storing and looking up strings. An example hash function maybe the sum of the ascii values of all the characters in the string, modulus an appropriate positive integer. For testing the code, utilize the ransom note and the magazines provided on the Black- board in files RansomNote.dat, Magazine1.dat, Magazine2.dat, Magazine3.dat, Magazine4.dat, Magazine5.datand Magazine6.dat.

In this problem, you will utilize the built in string class, its constructors, some of its methods and operators. For more on the string class, please refer to Prata, Chapter 16

2. Define, implement and test a Complex class, which has:
(a) At least two constructors.
(b) A destructor.
(c) Several Methods with functionality as described below:
- Returns real part.
- Returns imaginary part.
- Displays the number.
- Computes magnitude.
- Computes polar co-ordinates.
- Overloads operators +, -. * and /, with the corresponding operations.
- Overloads the operator ∼ for complex conjugate.
- Overloads the operators == and != for comparison.

The methods must make appropriate use of the reference variables, for arguments and re- turn types, as described in Prata, Chapter 10. For more details on operator overloading, refer to Prata, Chapter 11.

Discussion Board

There are points for participating in the Discussion Board. You are encouraged to ask questions on clarifying the assignments or related material, post your thoughts and some hints. Please do not post complete solutions.

Exercise Set

String class and Standard Template Libraries (STLs)
- Read in the six magazines from the files, one word at a time.
- Keep only the words, removing any punctuation or other characters.
- Store the words in a built-in STL container, such as array, vector or map.
- You are essentially building a repository of words.
- Design an algorithm for storing the words, such that you can easily find a word, without an exhaustive search through the repository.

Attachment:- Files.rar

Verified Expert

The first task was to read strings from a file called RansomNote.dat and 5 other files Magazine1.dat, Magazine2.dat, Magazine3.dat, Magazine4.dat, Magazine5.dat, Magazine6.dat and check if ransomNote.dat can be created from words present in the other files. The second task was to create a class called Complex and create 2 constructors, 1 destructor and overload operators +, - , *, / , ~, == and != .

Reference no: EM131889418

Questions Cloud

What is the change in net operating income : What is the change in net operating income after the changes?
List key characteristics of good strategic leaders : List key characteristics of good strategic leaders that lead to high performance? List two of these characteristics and list a real person/leader.
Assess the business impact of situation : Assess the business impact of this situation, describe how this process could be improved with information technology, and identify the decisions
What steps should we take after defining the gap : What steps should we take after defining the gap? What are some strategic actions we can take that might lead to not filling the gap in certain situations?
Define - implement and test a complex class : EEO 224: Object-Oriented Programming for Electrical and Computer Engineers - Classes, Reference Variables and the String Class
Name the different classifications of restaurants : 1. Name the different classifications of restaurants, and give examples of each as well as some of their unique characteristics.
Define the paraphrasing in brief : Provide a short summary discussing each phrase or term (two to three paragraphs for each) and provide an example of each as they pertain to writing.
Set up the business plan : How should this be conducted and what are the steps needed to set up the business plan?
Sorts the vector containing the lottery numbers : Sorts the vector containing the lottery numbers. Determines whether the player guessed the lottery numbers correctly.

Reviews

len1889418

3/6/2018 5:23:49 AM

3 Grading In addition to code functionality, there will be points for coding style, algorithm design and comments. A few useful comments would be sufficient. 4 Assignment Submission The Assignments must be submitted on the Blackboard, and should include the following: 1. The C++ source code, with one file per problem. 2. Screen shots which show each program executing. All the screen shots maybe in a single .pdf or .jpg file.

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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