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 5 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 5 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 5 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 5 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 5 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 5 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 5 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 5 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 protected
Would you like to ask this question?
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 5 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 5 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,731 satisfied customers

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

Manal Elkhoshkhany

Manal Elkhoshkhany

Tutor

4,551 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,636 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,161 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
Write out how to preform the following all variables are
Write out how to preform the following all variables are char. a is 0x100, b is 0x200, c is 0x300. Set up registers at the beginning using loads and tell me what each register is being used for. Also … read more
GLENN
GLENN
Master of Mathematics
359 satisfied customers
Functions Assignment For this assignment, you need to create
Functions Assignment For this assignment, you need to create a function that implements the Triangle Classification Algorithm. The algorithm has a lot of steps in it, but each step is simple. We have … read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
5,731 satisfied customers
What is the maximum amount of money someone can receive for
What is the maximum amount of money someone can receive for financial aid for college? lets say the tuition is $40k a year and the student have no EFC. Please also provide a breakdown of where the fin… read more
NPVAdvisor
NPVAdvisor
CFP Licensee and Practitioner
Master's Degree
180 satisfied customers
It's an Access datasheet: 4-4 Enter Names into a Database In
It's an Access datasheet: 4-4 Enter Names into a DatabaseIn Application 4-2, you practiced using alphabetic indexing rules 5–8 to file names that would appear on physical documentsIn this application,… read more
Richard
Richard
IT Manager
IT Manager, Consultant
3,313 satisfied customers
I have a graded project exam national electric code. can you
hello i have a graded project exam national electric code. can you help me get it done?. and how much would you charge?… read more
Chris Parson
Chris Parson
Electrician
19 satisfied customers
I have two more programs thati am looking for help on the
I have two more programs thati am looking for help on the deadline is Thursday by 9pm. Thank you!… read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
5,731 satisfied customers
Searching for a latin translation. Found a phrase on
searching for a latin translation. Found a phrase on gravestone. Ran it through Google Translate, but doesn't make sense to me in the context of a gravestone. maybe an expert could explain the phrase'… read more
Olivia Kent
Olivia Kent
Managing Partner
Doctoral Degree
2,182 satisfied customers
In a study of helicopter usage and patient survival, among
In a study of helicopter usage and patient survival, among the 52493 patients transported by helicopter, 294 of them left the treatment center agains medical advice and the other 52,199 did not leave … read more
GLENN
GLENN
Master of Mathematics
359 satisfied customers
I am working on a homework assignment and need answers about
I am working on a homework assignment and need answers about changing articles and adjectives … read more
Cher
Cher
JustAnswer Expert & Mentor;Teacher/Tutor
Masters Degree
1,382 satisfied customers
Subtraction Game, Name the file subtraction_game.py.
Subtraction Game, Name the file subtraction_game.py. ***Modify the below example so it meets the following requirements:**The new program shall present random subtraction questions to the player until… read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
5,731 satisfied customers
12. If the appellate court requires that issues be presented
12. If the appellate court requires that issues be presented in the form of questions, how should the questions be phrased? A. As briefly and broadly as possible, leaving details for the discussion in… read more
Cher
Cher
JustAnswer Expert & Mentor;Teacher/Tutor
Masters Degree
1,382 satisfied customers
Turtle ASCII Table. Name file turtle_ascii.py Using Turtle
Turtle ASCII Table. Name file turtle_ascii.pyUsing Turtle graphics:(Display the ASCII character table) Write a program that displays the characters in the ASCII character table from ! to ~. Display te… read more
Ingo U
Ingo U
Master\u0027s Degree
357 satisfied customers
Need help with the following two python based programs: 1) I
Need help with the following two python based programs:1) I need a program that reads four integer values corresponding to an IP address "a1.a2.a3.a4" (IPv4), and determines whether the values form a … read more
Ingo U
Ingo U
Master\u0027s Degree
357 satisfied customers
Writing/listening comprehension (50point), directions, you
Writing/listening comprehension (50point) , directions, you will hear a story in Spanish. In English, summarize the story in a composition of between ten and twenty sentences, the story is on 4L side … read more
Cher
Cher
JustAnswer Expert & Mentor;Teacher/Tutor
Masters Degree
1,382 satisfied customers
Network Administration (All essay answers need to be
Network Administration (All essay answers need to be double-spaced)1. Create a table the shows six of the common TCP/IP protocols installed on Windows Server 2012/R2. Protocol Name OSI Layer Function2… read more
David L.
David L.
Bachelor\u0027s Degree
6 satisfied customers
Research Paper Conduct a SWOT analysis and a financial
Research PaperConduct a SWOT analysis and a financial analysis for a telecommunication organization of your choice. Write a 5-8 page long paper and submit it to the Assignments Dropbox by the end of W… read more
GLENN
GLENN
Master of Mathematics
359 satisfied customers
Well I have a Project I need help with, I am new here but
well I have a Project I need help with, I am new here but really struggling with this one … read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
5,731 satisfied customers
Describe the main functions of a retail bank. Inputs,
how the information identified is captured by the bank, processed and disseminated… read more
judybailey61
judybailey61
Bachelors degree
196 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