Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in=new Scanner(System.in); String partyA="Democratic"; String partyB="Republican";...

1 answer below »

import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
String partyA="Democratic";
String partyB="Republican";
System.out.println("Answer the following questions: ");
char c1,c2,c3;
System.out.println("Are you black, hispanic, or Asian?\nA. Yes\nB. No");
c1=in.next().charAt(0);
System.out.println("Do you consider religion important?\nA. Yes\nB. No");
c2=in.next().charAt(0);
System.out.println("What should the government do to help the poor?\nA. Make it easier to apply for assistance. \nB. Put more money into schools.\nC. Incentivize welfare.\nD. Nothing.");
c3=in.next().charAt(0);

String predicted_party=" ";
if (c1=='A' || c2=='A' || c3=='A'||c3=='B')
predicted_party="Republican";
else if (c1=='B' || c2=='B' || c3=='C'||c3=='D')
predicted_party="Democratic";

int c;
String party=" ";
System.out.println("Which party do you belong to?\n1. Democratic\n2. Republican");
c=in.nextInt();
if (c==1)
party="Democratic";
else if (c==2)
party="Republican";

System.out.println("Your party is "+party+" and the predicted party is "+predicted_party);
}
}


2/12/22, 6:50 AM Artificial Intelligence - Assignment 2: AI Survey Program | Study.com
https:
study.com/academy/lesson/artificial-intelligence-assignment-ai-program.html 1/3
Arti�cial Intelligence - Assignment 2: AI Survey Program
If you have a Study.com College Accelerator membership and are seeking college credit for this course, you must submit an assignment and pass the
proctored �nal exam. You must submit your assignment before registering for the �nal. Below you will �nd prompts and instructions for submitting
your assignment.
About this Assignment
Data mining is used by everyone who wants to learn more about their customers or members. It helps people make decisions
about what to sell or what to promote. This assignment is to write a program using machine learning that will try to determine the
political leaning of the user based on a survey.
You will be tasked to write this program in either C++ or Java, whichever you feel more comfortable with.
Prompt
The goal is for the program to be able to guess the user's political party before they reach the end of the survey. This will require
your program to gather a substantial amount of data before it can make accurate guesses. In particular:
1. You should begin by presenting the user with questions that contain answer options that di�er based on their political beliefs.
Ex. What should the government do to help the poor?
A. Make it easier to apply for assistance.
B. Allow parents to use education funds for charter schools.
C. Create welfare to work programs.
D. Nothing.
https:
study.com/academy/course/computer-science-311-artificial-intelligence.html#credit
https:
study.com
2/12/22, 6:50 AM Artificial Intelligence - Assignment 2: AI Survey Program | Study.com
https:
study.com/academy/lesson/artificial-intelligence-assignment-ai-program.html 2/3
2. The last question should ask which political party they a�liate with. This way you will be able to gather and store data
co
esponding to the results you acquire. Create at least 4 political party storages.
3. As you gain more data on each political party, you should have a way of storing this information to create a program that will use
this data to accurately survey users and guess their political a�liations.
4. Some answers to questions co
espond with more than one political party. Find a way to make your program advanced enough
so that it can weigh answers with di�ering levels of intensity depending on which parties they co
espond best with.
5. Overall, for this assignment you will prepare data storage �les, obtain and store data through the usage of questions, and then
write code using machine learning to create a survey that will accurately guess a user's political party before they complete the
survey.
6. At the end of the assignment, you should submit a program that simply surveys a user and guesses their political party. The
more advanced your program is, the faster and more accurately it will guess the user's political party a�liation.
Grading Ru
ic
Your essay will be graded based on the following ru
ic:
Category Unacceptable (0-2) Needs Improvement (3-6) Good (7-8) Excellent (9-10)
Total
Possible
Points
Data Files and
Storage (x1)
No data �les created
or do not function
co
ectly at all.
Some data �les created and work
accurately, but not at least fou
created.
All four data �les
created and store
data accurately with
just a few mino
issues.
All four data �les created and
store data with no e
ors and is
well-organized.
10
Obtaining Data
(x2.5)
Student doesn't
follow instructions
on how to obtain
data at all/fails to
obtain any data.
Student somewhat follows
directions but doesn't obtain
co
ect data needed and/or doesn't
attempt to obtain data enough to
make an accurate program
Student obtains data
as instructed and
obtains enough data
to ensure accurate
program.
Student obtains data better than
instructed with no e
ors.
Exceeds the amount of data
equired to create great
program.
25
2/12/22, 6:50 AM Artificial Intelligence - Assignment 2: AI Survey Program | Study.com
https:
study.com/academy/lesson/artificial-intelligence-assignment-ai-program.html 3/3
Program
Speci�cations
(x2.5)
No code
submitted/Program
does not function
consistently or at all.
Code inco
ectly guesses political
party a�liation or takes too long to
guess.
Code co
ectly
guesses political
party. Student doesn't
account for weights of
answers.
Code co
ectly and rapidly
guesses political party and
accounts for weights of answers
25
Good
Practice/E�ciency
(x1)
Code not written
e�ciently, succinctly,
or using best
practices. No
comments o
headers.
Code is repetitive and complicated.
Excessive commenting or lack of
comments.
Code is written well
with good practices.
Minor issues related
to commenting and
organization.
Code is written in a sophisticated
manner and uses best practice in
all areas. Code is commented
appropriately and in a
meaningful manner.
10
Before You Submit
When you complete your assignment, we suggest taking some time to check for e
ors and add helpful comments to the code. You
should make sure the program works by debugging it to check for intended outcome and checking the content of the data �les.
How to Submit Your Assignment
When you are ready to submit your assignment, please �ll out the following submission form by attaching your data �les as
.txt �les and your code as a .cpp or .java �le. After turning in your assignment, you may go ahead and take the proctored �nal
exam. You do not need to wait for your written response to be graded. You should receive your assignment grade within one week.
If you are not satis�ed with the score you receive on your assignment, you may revise or rewrite it, and resubmit them for grading
using the same submission form above. Keep in mind that the grade you receive on your assignment is only a portion of you
overall grade for the course, and you are free to retake the proctored �nal exam as well if you choose. Please see the course
syllabus for a more detailed
eakdown of the grading policy.
Answered 8 days After Feb 12, 2022

Solution

Kshitij answered on Feb 14 2022
113 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here