Question: I need to create a program that asks a series of questions with yes or no answers. Basically, the program asks 3 questions if you

I need to create a program that asks a series of questions with yes or no answers. Basically, the program asks 3 questions if you would like to buy something and you respond yes or no to each item. It then totals everything up at the end. This might be pretty simple, but I am very new to programming and would appreciate all of the help I could get!

I have tried a few approaches, but I keep getting stuck on each one.

This is what I have so far. import java.util.Scanner;

public class MVProject { public static void main (String [] args) { Scanner console = new Scanner(System.in); // obtaining values System.out.println("Do you want service A ($8/month)?"); boolean hasServiceA = console.nextBoolean(); System.out.println("Do you want serviceB ($10/month?"); boolean hasServiceB = console.nextBoolean(); System.out.println("Do you want ServiceC ($7/month)?"); boolean hasServiceC = console.nextBoolean(); //compute results

I have also tried this approach, but am getting stuck on this one as well.

import java.util.Scanner; public class MVProject { static Scanner entry = new Scanner(System.in); public static void main (String [] args) { } public static boolean hasServiceA() { boolean yes = true; boolean no = false; System.out.println("Do you want serviceA ($8/month)?"); return false;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!