Homework

Homework Questions? Ask a Tutor for Answers ASAP

Ask an Expert,
Get an Answer ASAP!

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
Was this answer helpful?

How JustAnswer works

step-image
Describe your issueThe assistant will guide you
step-image
Chat 1:1 with a tutorLicensed Experts are available 24/7
step-image
100% satisfaction guaranteeGet all the answers you need
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,867 satisfied customers

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

Manal Elkhoshkhany

Manal Elkhoshkhany

Tutor

4,556 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,698 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,190 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
JAVA] Add capability to given program to handle Grade Book
JAVA] Add capability to given program to handle Grade Book for different subjects (Chemistry and Computer Science). We will assume a maximum of five assignments and up to 40 students.… read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
5,867 satisfied customers
Need help with my home work. Python. Learn as well as get my
need help with my home work JA: Is there a specific language you're coding in? Customer: yes python JA: What's your objective for this Python project? Customer: learn as well as get my homeworks done … read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
5,867 satisfied customers
Question #1 A statics professor plans class so carefully
quot;For Sandhya" Question #1 A statics professor plans class so carefully that the lengths of her classes are uniformly distributed between 47.0 and 57.0 minutes. Find the probability that a given cl… read more
Sandhya_sharma
Sandhya_sharma
Master\u0027s Degree
560 satisfied customers
Due Friday by 11:59pm NAME nfa2dfa - deterministic finite
Due Friday by 11:59pm NAME nfa2dfa - deterministic finite automaton checkSYNOPSIS nfa2dfa nfafileSPECIFICATION A nondeterministic finite automaton is defined as five tuple M = (Q,S,F,q0,δ) where: • Q … read more
Bruce Wilner
Bruce Wilner
Master of Engineering
29 satisfied customers
My calculations (see uploaded spreadsheet) do exactly what I
My calculations (see uploaded spreadsheet) do exactly what I want. My problem is controlling what the user sees. I want different portions of the worksheet to appear or disappear, depending upon choic… read more
GLENN GILONGOS
GLENN GILONGOS
Master of Mathematics
418 satisfied customers
I need answers to my homework questions and I need to submit
I need answers to my homework questions and I need to submit by today 11:59 pm and I am looking for help. I really need this cause I am way behind in assignments. … read more
Sandhya_sharma
Sandhya_sharma
Master\u0027s Degree
560 satisfied customers
For LogicPro only Purpose: Use a Priority_queue to simulate
For LogicPro onlyPurpose: Use a Priority_queue to simulate a Binary_TreeTechniques/Structures: Polymorphism, SmartPointers, Priority_Queue, LambdasStep1: Create a frequency table of ascii characters b… read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
5,867 satisfied customers
1. If a 2:1 transformer has a 220 VAC input, a voltage test
1. If a 2:1 transformer has a 220 VAC input, a voltage test at the primary winding should produce a meter reading of A. 0 VAC. B. 110 VAC. C. 220 VAC. D. 440 VAC. 2. A circuit contains four 100 Ω resi… read more
Sandhya_sharma
Sandhya_sharma
Master\u0027s Degree
560 satisfied customers
The project consist of a set of data with three independent
The project consist of a set of data with three independent questions.1. Create a histogram or bar graph for some variable categorized by age and split for men and women. This extends the idea of bar … read more
GLENN GILONGOS
GLENN GILONGOS
Master of Mathematics
418 satisfied customers
Create an Io program that duplicates the Java example
For Logic Pro onlyCreate an Io program that duplicates the Java example SortedList.java, in both functionality and object-oriented design It is assumed that your program can be run like this: io Sorte… read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
5,867 satisfied customers
I need this Project Answer by 6:00 pm today June 19 2018,
I need this Project Answer by 6:00 pm today June 19 2018, and I would like to be notified if a writer would take the question. If Writer Grace is available I would like her if not anyone can take it.U… read more
GLENN GILONGOS
GLENN GILONGOS
Master of Mathematics
418 satisfied customers
I need answers for my associates accounting exams,
Hi JA: Hello. How can I help? Customer: I need answers for my associates accounting exams JA: The Tutor can help you get an A on your homework or ace your next test. Tell me more about what you need h… read more
Manal Elkhoshkhany
Manal Elkhoshkhany
Tutor
4,556 satisfied customers
What is the answer? Nonparametric statistics requires a
What is the answer ? Nonparametric statistics requires a larger sample size because of ? a. Sensivity B.range of scores C.variance D.power… read more
GLENN GILONGOS
GLENN GILONGOS
Master of Mathematics
418 satisfied customers
I have a requirement to write an Oracle PL/SQL code to
I have a requirement to write an Oracle PL/SQL code to delete about 9 billion records in small batches of 10,000. The procedure should run quasi permanently (loop/sleep) and must backup (log/copy) the… read more
Chris Baxter
Chris Baxter
28 satisfied customers
I need help creating an excel formula (i'm assuming an IF or
I need help creating an excel formula (i'm assuming an IF or SUM IF) where certain pick list values need to be selected across columns B-N of my sheet in order to return a YES, NO, or TBD answer in co… read more
The-PC-Guy
The-PC-Guy
Bachelor\u0027s Degree
630 satisfied customers
I have a written code for C++ for the lottery. I have I
Hello, I have a written code for C++ for the lottery … read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
5,867 satisfied customers
Random and independent samples of 85 recent prime time
Random and independent samples of 85recent prime time airings from each of two major networks have been considered. The first network aired a mean of 110.7commercials during prime time, with a standar… read more
Sandhya_sharma
Sandhya_sharma
Master\u0027s Degree
560 satisfied customers
This question in only for Teacher Keys! Could you please
This question in only for Sarah TeacherKeysHi, Sarah! Could you please help me find the blank models for the two keys I'm going to indicate ? Photos are attachedThe squared key says 1c arrow. If you h… read more
Sarah
Sarah
Teacher
Master\u0027s Degree
19 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