Homework

Homework Questions? Ask a Tutor for Answers ASAP

Ask an Expert,
Get an Answer ASAP!

Homework
This answer was rated:

C++ write a program for a computer dating service The

C++ write a program for...

C++ write a program for a computer dating service


 


The input is a text file, clients.txt, which presents the information in a following format. (txt file contents provided below)


Column 1: a character indicating the client's sex, 'M' or 'F'


Column 2: a blank Columns 3 through 22: the 10 answers, with a blank after each


Columns 23 through end of line: client's name (starts in column 23)


 


 


To decide how compatible two people are, they take the absolute value of the difference between the answers of the two people on each of the 10 questions, and add all of these absolute values together. The result is called their difference index. To select a date for a client in this program, the company determines which client of the opposite sex has the LOWEST difference index with that person. Note: in order to keep this program simpler and at a reasonable level of difficulty and length for this course, the program will only process matching opposite sex clients. Your task is to write a program which takes as input a file containing client data, and finds each person's most compatible date according to the method described.


 


Data Structures. You are required to read the data into two arrays of structs, one storing males and one storing females, in separate data structures. Inside each client struct, there must be an array member which stores the answers to the client's questions. The typedef construct is required and must be used to set up data types for all arrays used in your program. After reading the data into the data structures, go on to process the information as required, utilizing those data structures. Do not create any classes. Do not use any classes other than the C++ standard string class (for a client name) and the C++ standard iostream classes (for standard IO). Do not use anything from the C++ Standard Template Library with the only exception being the string class


 


. If the character in column 1 is not an 'M' or an 'F' (uppercase only), print a suitable error message, and do not include any information from that line in your client data structures. If a question answer is not a 1, 2, 3, 4, or 5, then change the number to a 3, and print a suitable error message. If this occurs, you may "echoprint" the erroneous value as a 3. It is possible that the same name may occur more than once in the file. If this happens, again print out an error message, and use only the first occurrence of that person in the file in your data structure. Note that all input is echoprinted even if errors occur, with the exception that an invalid answer may be replaced with a 3 in the output. You may hardcode the file name into your program. You are still required to implement a check to see if the data file has opened successfully, and if it has not, your code must terminate the program with an error message. You may use either the return function and implement a 2nd return in main (like the return , or you may use the exit function and exit from any point in the program Processing and output Echoprint the client data as you read it in, giving any error messages at this time. This should be done in tabular form. Note that a single line of data may require more than one error message to be printed. Now, for each female client (in the order read in, you do NOT have to sort any data in this project), sequentially go through the list of male clients to find the one with the lowest difference index. If a tie occurs, let the most compatible date be the one found first in the list (of those who tie for the lowest index).


 


After you have finished finding matches for females, go on and do the same thing for each male, again in the order they were read in. Hence if you have 5 male and 5 female clients, you would end up with 10 possible couples. The program must reprint the information from clients.txt as well as print couples that match according to the algorithm provided


 


M 1 2 3 4 5 5 4 3 2 1 Denzel Washington


F 1 1 2 2 3 3 4 4 5 5 Madonna


M 2 4 1 3 5 4 2 3 1 1 Al Pacino


M 1 1 1 2 2 2 3 3 3 4 Bill Clinton


F 2 3 4 5 4 3 2 1 3 2 Whitney Houston


M 1 1 1 1 1 1 1 1 1 1 George W. Bush


F 5 5 5 5 5 0 5 5 5 5 XXXXX XXXXX


F 1 2 3 4 1 6 3 4 1 1 Madonna


F 4 2 4 2 5 3 5 3 1 1 Michelle Pfeifer


F 5 4 5 4 5 4 5 4 5 4 Miss Piggy


M 5 4 5 4 5 4 5 4 5 4 Kermit the Frog


M 1 3 5 2 4 1 3 2 4 5 Wesley Snipes


F 1 1 1 1 1 1 1 1 1 1 Gwyneth Paltrow


x 3 2 3 4 3 2 3 4 3 2 David Bowie


M 5 5 5 5 5 5 5 5 5 5 Michael Douglas


M 3 3 3 3 3 3 3 3 3 3 XXXXX XXXXX


M 1 2 3 4 5 1 2 3 4 5 Denzel Washington


M 1 4 2 5 3 5 4 2 3 1 Mel Gibson


M 4 2 5 3 4 2 3 1 1 1 Peter Gabriel


F 1 3 2 4 5 7 5 2 2 2 Hillary Clinton


F 5 5 5 4 4 4 3 3 3 2 Lucy Liu


F 1 1 2 2 3 3 4 4 5 5 XXXXX XXXXX


F 5 4 3 5 4 3 5 4 3 2 Madonna


 


 


 

Show More
Show Less
Ask Your Own Homework Question
Answered in 1 hour by:
12/2/2012
Martin
Martin, Physicist
Category: Homework
Satisfied Customers: 781
Experience: 20+ years of research, engineering and teaching
Verified
I can help you with this. Can you please provide any code you have written, and tell me the deadline? Thanks!
Ask Your Own Homework Question
Customer reply replied 4 years ago

Due Tuesday December 4, 2012 11:59PM EST


I unfortunately don't have my code to provide my files were deleted in a virus!


 

That's OK. I'll get started. Is plain vanilla C++ OK?
Ask Your Own Homework Question
Customer reply replied 4 years ago

Yep plain vanilla C++! all the necessary structures as well as what is prohibited are provided in the description Thank you!

You bet. Thanks
Ask Your Own Homework Question
Customer reply replied 4 years ago

Any updates? received an email but was not able to read it said something about you contacting me.

I didn't send you an email, but I am working on the project as we speak. Thanks for keeping an eye out -- I may have questions down this morning, and will post them here if so. Otherwise, I should wrap this up this evening.
Ask Your Own Homework Question
Customer reply replied 4 years ago

Thank you for your swift response and i apologize for the confusion. I will keep my ears open.

Thanks. So far so good, but I do have one quick item. The instructions say we're limited to including <iostream> and <string>. However, I am also having to use <fstream> to open and read the file. I believe we need this. Do you agree?
Ask Your Own Homework Question
Customer reply replied 4 years ago

Yes <fstream> is ok to use!

OK, here is your program and output:

C++ program (as Word doc)
Output of program

Please let me know how it goes. If you have any other questions, please specify "For Martin" at the beginning of your question, and I'll be sure to get it.

Thanks!
Ask Your Own Homework Question
Customer reply replied 4 years ago

The program isnt running in Visual C++ 2010 Express due to syntax errors and an intialization error from double to int.

OK, let me check it out on some alternate systems. I don't have VC++, but should be able to fix this...
Ask Your Own Homework Question
Customer reply replied 4 years ago

Thank you! also what is 1e8? used with miniscore

1e8 = 1 times ten to the 8th power. You might just replace this with(NNN) NNN-NNNNin both spots. Maybe VC++ is freaking out about this?

It passes all checks on my systems. Can you perhaps cut/paste the compiler vomit into a note here? That might be enough for me to pinpoint the problem(s).
Ask Your Own Homework Question
Customer reply replied 4 years ago

1>------ Build started: Project: Program 6, Configuration: Debug Win32 ------
1> P6.cpp
1>c:\users\rascal\documents\visual studio 2010\projects\program 6\program 6\p6.cpp(76): error C2146: syntax error : missing ')' before identifier 'and'
1>c:\users\rascal\documents\visual studio 2010\projects\program 6\program 6\p6.cpp(76): error C2065: 'and' : undeclared identifier
1>c:\users\rascal\documents\visual studio 2010\projects\program 6\program 6\p6.cpp(76): error C2146: syntax error : missing ';' before identifier 'sex'
1>c:\users\rascal\documents\visual studio 2010\projects\program 6\program 6\p6.cpp(76): error C2059: syntax error : ')'
1>c:\users\rascal\documents\visual studio 2010\projects\program 6\program 6\p6.cpp(76): error C2143: syntax error : missing ';' before '{'
1>c:\users\rascal\documents\visual studio 2010\projects\program 6\program 6\p6.cpp(86): error C2146: syntax error : missing ')' before identifier 'or'
1>c:\users\rascal\documents\visual studio 2010\projects\program 6\program 6\p6.cpp(86): error C2065: 'or' : undeclared identifier
1>c:\users\rascal\documents\visual studio 2010\projects\program 6\program 6\p6.cpp(86): error C2146: syntax error : missing ';' before identifier 'q'
1>c:\users\rascal\documents\visual studio 2010\projects\program 6\program 6\p6.cpp(86): error C2059: syntax error : ')'
1>c:\users\rascal\documents\visual studio 2010\projects\program 6\program 6\p6.cpp(86): error C2143: syntax error : missing ';' before '{'
1>c:\users\rascal\documents\visual studio 2010\projects\program 6\program 6\p6.cpp(86): warning C4552: '>' : operator has no effect; expected operator with side-effect
1>c:\users\rascal\documents\visual studio 2010\projects\program 6\program 6\p6.cpp(146): warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data
1>c:\users\rascal\documents\visual studio 2010\projects\program 6\program 6\p6.cpp(156): warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


i manged to fix the identifiers with && and || however


 


i believe the 1e8 is causing the double to int problem so i guess changing it to(NNN) NNN-NNNNwould fix it?

THIS ANSWER IS LOCKED!
You can view this answer by clicking here to Register or Login and paying $3.
If you've already paid for this answer, simply Login.
Martin
Martin, Physicist
Category: Homework
Satisfied Customers: 781
Experience: 20+ years of research, engineering and teaching
Verified
Martin and 87 other Homework Specialists are ready to help you
Ask your own question now
Customer reply replied 4 years ago

1>LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt


 


Now I got this error.

Well, unfortunately, this appears to be a problem related to your MS Visual C++ related environment, which I do not have access to.

I googled it (as you probably have) and found this thread discussing a) turning off incremental linking, b) installing SP1, or c) resolving a conflict between Visual Studio 2012 and 2010.

Wow. Is this limited to this program? Can you strip this down to a "hello world" program and compile it?
Ask Your Own Homework Question
Customer reply replied 4 years ago

Service Pack 1 managed to fix it! thank you for your help and diligence!

Super! Let me know if there's anything else. Once you verify it's working right, please don't forget to accept and rate the answer. And if you need any further assistance, please specify "For Martin:" at the beginning of your new questions, and I'll be sure to get them.

Thanks
Ask Your Own Homework Question
Hello again.

I hope my answers have been helpful. Please let me know any time you need help. Just put "For Martin" at the beginning of your question, and I'll be sure to get it.

Thanks,
Ask Your Own Homework Question
Ask Martin Your Own Question
Martin
Martin
Martin, Physicist
Category: Homework
Satisfied Customers: 781
781 Satisfied Customers
Experience: 20+ years of research, engineering and teaching

Martin is online now

A new question is answered every 9 seconds

How JustAnswer works:

  • Ask an ExpertExperts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional AnswerVia email, text message, or notification as you wait on our site. Ask follow up questions if you need to.
  • 100% Satisfaction GuaranteeRate the answer you receive.

JustAnswer in the News:

Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.

What Customers are Saying:

Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help.

Mary C.Freshfield, Liverpool, UK

This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!!

AlexLos Angeles, CA

Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult.

GPHesperia, CA

I couldn't be more satisfied! This is the site I will always come to when I need a second opinion.

JustinKernersville, NC

Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around.

EstherWoodstock, NY

Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know.

RobinElkton, Maryland

He answered my question promptly and gave me accurate, detailed information. If all of your experts are half as good, you have a great thing going here.

DianeDallas, TX

< Previous | Next >

Meet the Experts:

LogicPro

LogicPro

Engineer

5,672 satisfied customers

Expert in Java C++ C C# VB Javascript Design SQL HTML

Manal Elkhoshkhany

Manal Elkhoshkhany

Tutor

4,549 satisfied customers

More than 5000 online tutoring sessions.

Linda_us

Linda_us

Finance, Accounts & Homework Tutor

3,138 satisfied customers

Post Graduate Diploma in Management (MBA)

Chris M.

Chris M.

M.S.W. Social Work

2,635 satisfied customers

Master's Degree, strong math and writing skills, experience in one-on-one tutoring (college English)

F. Naz

F. Naz

Chartered Accountant

2,158 satisfied customers

Experience with chartered accountancy

Bizhelp

Bizhelp

CPA

1,887 satisfied customers

Bachelors Degree and CPA with Accounting work experience

Seanna

Seanna

Tutor

1,781 satisfied customers

3,000+ satisfied customers, all topics, A+ work

< Previous | Next >

Related Homework Questions
HEALTH, SAFETY, AND NUTRITION FOR THE CHILD 605844RR -
HEALTH, SAFETY, AND NUTRITION FOR THE YOUNG CHILD 605844RR - Preventing Illness and Injuries When you have completed your exam and reviewed your answers, click Submit Exam. Answers will not be recorde… read more
GLENN
GLENN
Master of Mathematics
330 satisfied customers
FOR Discussion Question 1 • Due Date: Day 2 [post to the
FOR ANGELA Discussion Question 1 • Due Date: Day 2 [post to the Main forum] • Post your response to this question: Consider the statement “psychology has a long past but a short history.” What do you … read more
Seanna
Seanna
Tutor
1,781 satisfied customers
When I open a word document it has a character string 20 and
When I open a word document it has a character string 20 and places that character after I type each line. This is just a recent problem and. How can have work not insert that character?… read more
F. Naz
F. Naz
Chartered Accountant
CA Finalist & Completed B.com
2,158 satisfied customers
I need help regarding javascript with custom objects and
I need help regarding javascript with custom objects and constructors. I am having trouble calling an onclick function in a form to an array.… read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
5,672 satisfied customers
Fiscal restraint is defined as: a. Tax hikes or spending
Fiscal restraint is defined as: a. Tax hikes or spending cuts intended to reduce aggregate demand. b. Tax hikes or spending cuts intended to increase aggregate demand. c. Tax cuts or spending hikes in… read more
Chris M.
Chris M.
M.S.W. Social Work
Master's Degree
2,635 satisfied customers
Explain the types purpose and function of materials and
Explain the types purpose and function of materials and equipment needed for the administration of medication via the different routes … read more
Dr. Donna Kakonge
Dr. Donna Kakonge
Doctor of Education
189 satisfied customers
I have a couple of basic java questions i need answered.
I have a couple of basic java questions i need answered … read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
5,672 satisfied customers
The Use case diagram for a tracking system using clusters of
The Use case diagram for a tracking system using clusters of sensors. I am now in phase 3 and I did all the documentation but I need to deeply understand the logic behind the IoT to proceed correctly … read more
Dr. Donna Kakonge
Dr. Donna Kakonge
Doctor of Education
189 satisfied customers
This week you'll be making the following refinements to the
This week you'll be making the following refinements to the class that you wrote in the last assignment. All the requirements from that class are still in force. For example, all MyStrings must always… read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
5,672 satisfied customers
I asked a question and will pay but the site asks me to
hi i asked a question and will pay but the site asks me to verify an ammount below 200 usd which i want to but it does not give me the option to do so, please help… read more
GLENN
GLENN
Master of Mathematics
330 satisfied customers
Which if the following is not included unpaid-in capital?
which if the following is not included unpaid-in capital? common stock pain-in capital-donations stock dividend distributable appropriation per loan agreement … read more
F. Naz
F. Naz
Chartered Accountant
CA Finalist & Completed B.com
2,158 satisfied customers
A rifle with a longer barrel can fire bullets with a larger
A rifle with a longer barrel can fire bullets with a larger velocity than a rifle with a shorter barrel. A. Explain this using the impulse momentum theorem B. Explain this using the work energy theore… read more
GLENN
GLENN
Master of Mathematics
330 satisfied customers
This question is just for Dr. Kakonge. This purpose is to
Hello. This question is just for Dr. Donna Kakonge.This purpose is to pay the payment to Dr. Donna Kakonge on 06/16/2017 again because of something wrong about payment on 06/16/2017.The question on 06… read more
Dr. Donna Kakonge
Dr. Donna Kakonge
Doctor of Education
189 satisfied customers
On Excel contour map want to: 1) rotate series 180 degrees
On Excel contour map want to: 1) rotate series 180 degrees but not category 2) edit series name for all 3) edit legend 4) fill in colour boxes 5) change colour boxes to meet colorirmetric convention.… read more
Dr. Donna Kakonge
Dr. Donna Kakonge
Doctor of Education
189 satisfied customers
I need to get an answer of the case Conveyor Belt Project.
I need to get an answer of the case Conveyor Belt Project … read more
Dr. Donna Kakonge
Dr. Donna Kakonge
Doctor of Education
189 satisfied customers
Where is the status bar? Im so sorry to be in a rush but if
where is the status bar? Im so sorry to be in a rush but if i fail my exam i have to redo my year … read more
The-PC-Guy
The-PC-Guy
Bachelor\u0027s Degree
628 satisfied customers
A recent survey found that 73% of all adults over 50 wear
A recent survey found that 73% of all adults over 50 wear sunglasses for driving. In a random sample of 20 adults over 50, what is the mean and standard deviation of those that wear sunglasses?… read more
Dr. Donna Kakonge
Dr. Donna Kakonge
Doctor of Education
189 satisfied customers
Is anyone familiar with Excel??? The link below will take
Is anyone familiar with Excel??? The link below will take you to my question. It is due 02/14/10 Sunday night , but the sooner the better. You will see "1: Five-Year Sales Projections" that is what I … read more
Stephen, MBA
Stephen, MBA
Master's Degree
166 satisfied customers
Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.

Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.

Show MoreShow Less

Ask Your Question

x