Rewrite below guessbirthday

Assignment Help Business Management
Reference no: EM132261097

Program: (Guess birthday) Rewrite below GuessBirthday.java to prompt the user to enter the character Y for Yes and N for No rather than entering 1 for Yes and 0 for No.

*** Please change the input answers from digits to using words. In this case "yes" or "no". Additionally we want to have them code the responses to account for user variability so that YES, Yes, yes, Y and y are all valid. So we need the student to use: if (answer.equalsIgnoreCase("yes")||answer.equalsIgnoreCase("y"))

Need to make adjustments to below program

import java.util.Scanner;

public class Listing04_3 {
  public static void main(String[] args) {
    String set1 =
      " 1  3  5  7n" +
      " 9 11 13 15n" +
      "17 19 21 23n" +
      "25 27 29 31";

    String set2 =
      " 2  3  6  7n" +
      "10 11 14 15n" +
      "18 19 22 23n" +
      "26 27 30 31";

    String set3 =
      " 4  5  6  7n" +
      "12 13 14 15n" +
      "20 21 22 23n" +
      "28 29 30 31";

    String set4 =
      " 8  9 10 11n" +
      "12 13 14 15n" +
      "24 25 26 27n" +
      "28 29 30 31";

    String set5 =
      "16 17 18 19n" +
      "20 21 22 23n" +
      "24 25 26 27n" +
      "28 29 30 31";

    int day = 0;

    // Create a Scanner
    Scanner input = new Scanner(System.in);

    // Prompt the user to answer questions
    System.out.print("Is your birthday in Set1?n");
    System.out.print(set1);
    System.out.print("nEnter 0 for No and 1 for Yes: ");
    int answer = input.nextInt();

    if (answer == 1)
      day += 1;

    // Prompt the user to answer questions
    System.out.print("nIs your birthday in Set2?n");
    System.out.print(set2);
    System.out.print("nEnter 0 for No and 1 for Yes: ");
    answer = input.nextInt();

    if (answer == 1)
      day += 2;

    // Prompt the user to answer questions
    System.out.print("Is your birthday in Set3?n");
    System.out.print(set3);
    System.out.print("nEnter 0 for No and 1 for Yes: ");
    answer = input.nextInt();

    if (answer == 1)
      day += 4;

    // Prompt the user to answer questions
    System.out.print("nIs your birthday in Set4?n");
    System.out.print(set4);
    System.out.print("nEnter 0 for No and 1 for Yes: ");
    answer = input.nextInt();

    if (answer == 1)
      day += 8;

    // Prompt the user to answer questions
    System.out.print("nIs your birthday in Set5?n");
    System.out.print(set5);
    System.out.print("nEnter 0 for No and 1 for Yes: ");
    answer = input.nextInt();

    if (answer == 1)
      day += 16;

    System.out.println("nYour birthday is " + day + "!");
  }
}

Reference no: EM132261097

Questions Cloud

Explain the methodologies used in preparing budgets : Explain the methodologies and processes used in preparing budgets for healthcare organizations (250 word minimum). The response must be typed.
Release from the semaphore queue is based : Fill in the Gant chart based on these conditions: (P, V, and context switch operations are instantaneous).Process P1 starts at time 0; P2 at time 3
Describe the role of culture in how people change : Describe the cultural identities, values, and experiences that led you to consider a career in counseling.
Write down the definition of the cyber domain : The Chief Information Officer (CIO) of the organization you chose in the Week 1 discussion, "Key Components of an Information System as Related to the Cyber.
Rewrite below guessbirthday : Program: (Guess birthday) Rewrite below GuessBirthday.java to prompt the user to enter the character Y for Yes and N for No rather than entering 1 for Yes and 0
Do you think that this might be something that you could do : Do you think that this might be something that you could do, and do you think it might be beneficial in helping you build cultural awareness and competency?
What negative consequences might follow : In a well-organized, two to three page essay discuss the case of NATIONAL FEDERATION OF INDEPENDENT BUSINESS ET AL. v. SEBELIUS. Be sure to include.
Design and implement an immutable fraction class : Design and implement an immutable Fraction Class described in the Fraction case study. Your class must have the following methods to emulate arithmetic
The data that jack has gathered qualitative in nature : Why are the data that Jack has gathered qualitative in nature? Describe three other techniques and/or sources to gather qualitative data.

Reviews

Write a Review

Business Management Questions & Answers

  Caselet on michael porter’s value chain management

The assignment in management is a two part assignment dealing 1.Theory of function of management. 2. Operations and Controlling.

  Mountain man brewing company

Mountain Man Brewing, a family owned business where Chris Prangel, the son of the president joins. Due to increase in the preference for light beer drinkers, Chris Prangel wants to introduce light beer version in Mountain Man. An analysis into the la..

  Mountain man brewing company

Mountain Man Brewing, a family owned business where Chris Prangel, the son of the president joins. An analysis into the launch of Mountain Man Light over the present Mountain Man Lager.

  Analysis of the case using the doing ethics technique

Analysis of the case using the Doing Ethics Technique (DET). Analysis of the ethical issue(s) from the perspective of an ICT professional, using the ACS Code of  Conduct and properly relating clauses from the ACS Code of Conduct to the ethical issue.

  Affiliations and partnerships

Affiliations and partnerships are frequently used to reach a larger local audience? Which options stand to avail for the Hotel manager and what problems do these pose.

  Innovation-friendly regulations

What influence (if any) can organizations exercise to encourage ‘innovation-friendly' regulations?

  Effect of regional and corporate cultural issues

Present your findings as a group powerpoint with an audio file. In addition individually write up your own conclusions as to the effects of regional cultural issues on the corporate organisational culture of this multinational company as it conducts ..

  Structure of business plan

This assignment shows a structure of business plan. The task is to write a business plane about a Diet Shop.

  Identify the purposes of different types of organisations

Identify the purposes of different types of organisations.

  Entrepreneur case study for analysis

Entrepreneur Case Study for Analysis. Analyze Robin Wolaner's suitability to be an entrepreneur

  Forecasting and business analysis

This problem requires you to apply your cross-sectional analysis skills to a real cross-sectional data set with the goal of answering a specific research question.

  Educational instructional leadership

Prepare a major handout on the key principles of instructional leadership

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd