Question

What is the output of the following program? Recall that the % operator returns the remainder...

What is the output of the following program? Recall that the % operator returns the remainder after performing the division (e.g. 7 % 4 == 3)
Show your steps - by 'hand' or at least show how you work through the logic as best you can.  

class Quest3

{

     Main() ANSWER

    {

        Write("H");

        Method1();

        WriteLine();

        ReadLine();

    }

     Method1()

    {

        Method2(3);

        Write("A");

        Method4();

        Write("V");

    }

     Method2(int x)

    {

        Write("E");

        if (x % 2 != 0)

            Method3();

    }

     Method3()

    {

        Write("F");

        Method2(0);

        Write("U");

    }

     Method4()

    {

        Write("N");

    }

}

0 0
Add a comment Improve this question Transcribed image text
Know the answer?
Add Answer to:
What is the output of the following program? Recall that the % operator returns the remainder...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • java Use the classes given in the previous question and write the output tha t is...

    java Use the classes given in the previous question and write the output tha t is generated when this program is run. You may write your answer as "Elaine 2 Jerry 1" or "Compiler Error" or "Runtime Error" If there is an error then explain why. public class Main{ public static void main(String args[]){ Object o = new Kramer(); ((George)(o)).method1(); ((Jerry)(o)). method1(); 0.method2(); public class George extends Elaine {! public void method1() { System.out.print("George 1 "); public class Jerry {...

  • The following file has syntax and/or logical errors. In each case, determine the problem, and fix...

    The following file has syntax and/or logical errors. In each case, determine the problem, and fix the program. using System; using static System.Console; using System.IO; class DebugFourteen1 { static void Main() { string fileName; string directory; string path; string files; int x; Write("Enter a directory: "); directory = ReadLine(); if(Directory.Exists(Directory)) { files = Directory.GetFiles(directory); if(files.Length = 0) WriteLine("There are no files in " + directory); else { WriteLine(directory + " contains the following files"); for(x = 0; x <= files.Length;...

  • In Chapter 11, you created the most recent version of the GreenvilleRevenue program, which prompts the...

    In Chapter 11, you created the most recent version of the GreenvilleRevenue program, which prompts the user for contestant data for this year’s Greenville Idol competition. Now, save all the entered data to a Greenville.ser file that is closed when data entry is complete and then reopened and read in, allowing the user to view lists of contestants with requested talent types. The program should output the name of the contestant, the talent, and the fee. using System; using static...

  • Use a C# In previous chapters, you have created programs for the Greenville Idol competition. Now...

    Use a C# In previous chapters, you have created programs for the Greenville Idol competition. Now create a Contestant class with the following characteristics: The Contestant class contains public static arrays that hold talent codes and descriptions. Recall that the talent categories are Singing, Dancing, Musical instrument, and Other. Name these fields talentCodes and talentStrings respectively. The class contains an auto-implemented property Name that holds a contestant’s name. The class contains fields for a talent code (talentCode) and description (talent)....

  • The following file has syntax and/or logical errors. Determine the problem and fix the program. //...

    The following file has syntax and/or logical errors. Determine the problem and fix the program. // Handles a Format Exception if user does not enter a number using System; using static Syst0em.Console; class DebugEleven1 { static void Main() { double salary; string salVal; bool isValidSalary; while(!isValidSalary) { try Write("Enter an employee's salary "); salVal = ReadLine(); salary = Convert.ToDouble(salVal); isValidSalary = true; catch(Formatexception fe) { WriteLine("You must enter a number for the salary."); } } WriteLine("The salary {0} is valid",...

  • C SHARP PROGRAM LANGUAGE The program below isn't working quite right. First compile and run it...

    C SHARP PROGRAM LANGUAGE The program below isn't working quite right. First compile and run it to familiarize yourself with the output. Then update the program to implement the following requirements: 1. the program shall sing ( display with WriteLine() ) the song's verses for drinks 100 through 91. 2. the program shall not sing the song's verses for drinks 90 - 7. 3. the program shall implement a string variable which is initialized by the programmer to the type...

  • In Chapter 4 of your book, you created an interactive application named MarshallsRevenue that prompts a...

    In Chapter 4 of your book, you created an interactive application named MarshallsRevenue that prompts a user for the number of interior and exterior murals scheduled to be painted during a month and computes the expected revenue for each type of mural. The program also prompts the user for the month number and modifies the pricing based on requirements listed in Chapter 4. Now, modify the program so that the user must enter a month value from 1 through 12....

  • Overload the + operator as indicated. Sample output for the given program: First vacation: Days: 7,...

    Overload the + operator as indicated. Sample output for the given program: First vacation: Days: 7, People: 3 Second vacation: Days: 12, People: 3 #include <iostream> using namespace std; class FamilyVacation{ public: void SetNumDays(int dayCount); void SetNumPeople(int peopleCount); void Print() const; FamilyVacation operator+(int moreDays); private: int numDays; int numPeople; }; void FamilyVacation::SetNumDays(int dayCount) { numDays = dayCount; return; } void FamilyVacation::SetNumPeople(int peopleCount) { numPeople = peopleCount; return; } // FIXME: Overload + operator so can write newVacation = oldVacation +...

  • In Chapter 5, you wrote a HomeSales application for three salespeople: Danielle, Edward, and Francis. Now,...

    In Chapter 5, you wrote a HomeSales application for three salespeople: Danielle, Edward, and Francis. Now, using the code you wrote in Chapter 5, Programming Exercise 5, modify the program to use arrays to store the salesperson names, allowed initials, and accumulated sales values. In order to prepend the $ to currency values, the program will need to use the CultureInfo.GetCultureInfo method. In order to do this, include the statement using System.Globalization; at the top of your program and format...

  • In Chapter 5, you wrote a HomeSales application for three salespeople: Danielle, Edward, and Francis. Now,...

    In Chapter 5, you wrote a HomeSales application for three salespeople: Danielle, Edward, and Francis. Now, using the code you wrote in Chapter 5, Programming Exercise 5, modify the program to use arrays to store the salesperson names, allowed initials, and accumulated sales values. In order to prepend the $ to currency values, the program will need to use the CultureInfo.GetCultureInfo method. In order to do this, include the statement using System.Globalization; at the top of your program and format...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT