1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Evgen [1.6K]
3 years ago
9

Write a switch statement that tests the value of the char variable response and performs the following actions: if response is y

, the message "Your request is being processed" is printed if response is n, the message "Thank you anyway for your consideration" is printed if response is h, the message "Sorry, no help is currently available" is printed for any other v
Computers and Technology
1 answer:
Yuri [45]3 years ago
7 0

Answer:

# include<iostream>

#include<conio.h>

using namespace std;

main()

{

char choice;

cout<<"Enter your Choice"

cin>>choice;

switch (choice)

{

case 'y':

cout<<"Your request is being processed";

break;

case 'n':

cout<<"Thank you anyway for your consideration";

break;

case 'h':

cout<<"Sorry, no help is currently available";

default:

cout<<"Incorrect Choice";

break;

}

getch();

}

Explanation:

In this program, a character type variable named as choice is selected for the input. This choice variable can be y, n or h as per requirement of the program. Switch statement is chose for the selection of output statement with respect to its mentioned input.  This program shows the output statement for above mentioned characters. In case of any other character the program returns Incorrect choice and ends.

You might be interested in
Which operating system is a version of Linux?​
Lunna [17]

Answer:

MS-DOS

Explanation:

The only operating system which is a version of Linux.

3 0
3 years ago
Write a method named showChar. The method should accept two arguments: a reference to a String object and an integer. The intege
matrenka [14]

A complete program with the method ShowCar:

import java.util.Scanner; // header file

public class ShowChar

{

public static void main(String[] args)

{

String lnOfText;

int i;

Scanner input = new Scanner(System.in);

System.out.print("Enter a line of text:");

lnOfText = input.nextLine();

System.out.print(" Enter your index: ");

i = input.nextInt();

show_Char(lnOfText,i);

}

public static void show_Char(String str_a, int i)

{

System.out.print(str_a.charAt(i));

}

}

In this program, both the inputs ie. a sentence or line of text as well as the index position is obtained. A method is written to find the string at that particular position. Finally the method prints that character at the particular index.

5 0
3 years ago
Exactly how many times must the merge function call each of read and write to merge two arrays of size n/2 into an array of size
Rom4ik [11]

Answer:

Exactly how many times must the merge function call each of read and write to merge two arrays of size n/2 into an array of size n, assuming

i don t know

7 0
3 years ago
Design a class named largeIntegers such that an object of this class can store an integer of any number of digits. Add operation
SpyIntel [72]

Answer:

Here the code is given as follows,

Explanation:

Code:

import java.util.Scanner;

//created class named largeintegers

class largeintegers{

   //class can hold a long number

   long number;

   //constructor to set number

  largeintegers(long number){

      this.number=number;

  }

  //getNumber method to get number

  long getNumber(){

      return number;

  }

  //below are some basic operations

  long addition(long num1,long num2){

       return num1+num2;

   }

   long subtract(long num1,long num2){

       return num1-num2;

   }

   long multiply(long num1,long num2){

       return num1*num2;

   }

   boolean compare(long num1,long num2)

   {

       return num1>num2;

   }

  public static void main(String[] args) {

      //declared to long numbers

      long number1,number2;

      //scanner class to take user input

      Scanner sc= new Scanner(System.in);

      //taking input numbers

      System.out.println("Enter a Number ");

      number1=sc.nextLong();

      System.out.println("Enter 2nd Number :");

      number2=sc.nextLong();

      //created two objects

      largeintegers object=new largeintegers(number1);

      largeintegers object2=new largeintegers(number2);

      //displaying two numbers

      System.out.println("Entered Numbers ");

      System.out.println(object.getNumber());

      System.out.println(object2.getNumber());

      //calling basic methods using created objects

      System.out.println("Some Operations on Given two Numbers ");

      System.out.println("Addition:"+object.addition(object.getNumber(), object2.getNumber()));

      System.out.println("Subtraction:"+object.subtract(object.getNumber(), object2.getNumber()));

      System.out.println("Multiplication:"+object.multiply(object.getNumber(), object2.getNumber()));

      System.out.println("Comparison:");

      if(object.compare(object.getNumber(), object2.getNumber())==true)

      {

          System.out.println("First Number is Greater than Second Number ");

      }

      else

      {

          System.out.println("Second Number is Greater than First Number ");

      }

      sc.close();

  }

}

Output:-

6 0
3 years ago
Your sister wants to purchase Microsoft Office 2013 for her new laptop. She doesn't want to pay for a subscription, and she want
Pavel [41]

I would buy Microsoft Office 2013 Home and Business Pc License. Its better to purchase the product in all rather than a subscription.

5 0
3 years ago
Other questions:
  • If you have long column labels with columns so wide that they affect the readability of a worksheet, you should first
    15·2 answers
  • Complex machines are defined by...
    14·2 answers
  • Write a program to read customer number, Name, loan amount, interest rate and time of repayment. Calculate and display the EMI .
    9·1 answer
  • Construct a regular expression that recognizes the following language of strings over the alphabet {0 1}:
    10·1 answer
  • What is the function of napier's bones<br>​
    8·1 answer
  • Fast we need help What is binary code? Why do computers use binary code?
    8·2 answers
  • Which option is correct??
    8·1 answer
  • Most portable devices, and some computer monitors have a special steel bracket security slot built into the case, which can be u
    13·1 answer
  • Name 6 examples of how telemedicine is used in healthcare
    7·1 answer
  • What virtual, logically defined device operates at the data link layer to pass frames between nodes?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!