Question

//Banner.cs //Created on Page 277 //Modified on Page 288 //Modified on Page 289 //Modified on Page...

//Banner.cs
//Created on Page 277
//Modified on Page 288
//Modified on Page 289
//Modified on Page 292
//Modified on Page 295
//Modified on Page 301
//Example10_1, page Page 452
using System;

public class Example10_1 {
public static void Main (string[] args) {

Banner[] x = new Banner[10];
x[0] = new Banner();
x[0].favoriteProgram = "C#";
x[0].Display();

x[1] = new Banner();
x[1].favoriteProgram = "Visual Basic";
x[1].Display();

for (int row = 0; row < 2; row++) {
Console.WriteLine(x[row].favoriteProgram);
}

}
}


public class Banner {
public string favoriteProgram;
public static int numberOfBannerObjects;

public Banner() {
Console.WriteLine ("Banner's Constructor");
numberOfBannerObjects++;
favoriteProgram = "C#";
}

public Banner(string param1) {
Console.WriteLine ("Banner's Overloaded Constructor");
numberOfBannerObjects++;
favoriteProgram = param1;
}

~Banner() {
Console.WriteLine ("Banner's Destructor");
}

public void HowMany() {
Console.WriteLine ("The number of Banner objects is " + numberOfBannerObjects);
}

public void Display() {
Console.WriteLine ("I love " + favoriteProgram);
}
}

Add an additional banner object, and then make use of the HowMany() method to display how many objects have been created in the console window. How is each specific line in the console window being generated? Is the Main method explicitly calling each of the requisite Banner methods?

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
//Banner.cs //Created on Page 277 //Modified on Page 288 //Modified on Page 289 //Modified on Page...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • C++ This exercise will introduce static member variables and static methods in class to you. Class...

    C++ This exercise will introduce static member variables and static methods in class to you. Class Department contain information about universities departments: name students amount in addition it also stores information about overall amount of departments at the university: departments amount class Department { public: Department(string i_name, int i_num_students); ~Department(); int get_students(); string get_name(); static int get_total(); private: string name; int num_students; static int total_departments; }; Carefully read and modify the template. You have to implement private static variable "total...

  • Language is C++ Basic principles and theory of structured programming in C++ by implementing the class:...

    Language is C++ Basic principles and theory of structured programming in C++ by implementing the class: Matrix Use these principles and theory to help build and manipulate instances of the class (objects), call member functions Matrix class implementation from the main function file and, in addition, the Matrix class must have its interface(Matrix.h) in a separate file from its implementation (Matrix.cpp). The code in the following files: matrix.h matrix.cpp matrixDriver.h Please use these file names exactly. Summary Create three files...

  • 1. What is the output when you run printIn()? public static void main(String[] args) { if...

    1. What is the output when you run printIn()? public static void main(String[] args) { if (true) { int num = 1; if (num > 0) { num++; } } int num = 1; addOne(num); num = num - 1 System.out.println(num); } public void addOne(int num) { num = num + 1; } 2. When creating an array for primitive data types, the default values are: a. Numeric type b. Char type c. Boolean type d. String type e. Float...

  • Include a second string auto-implemented property that represents the name of the course’s instructor. Modify the...

    Include a second string auto-implemented property that represents the name of the course’s instructor. Modify the constructor to specify two parameters—one for the course name and one for the instructor’s name. Modify method DisplayMessage such that it first outputs the welcome message and course name, then outputs "This course is presented by: ", followed by the instructor’s name. Use your modified class in a test app that demonstrates the class’s new capabilities. NOTE: You will need both a GradeBook file...

  • Draw memory diagrams for all variables and objects created using during the execution of main method...

    Draw memory diagrams for all variables and objects created using during the execution of main method below: class Singleton {     private int value;     Singleton( int value ) {         this.value = value;     } } class Pair {     private Object first;     private Object second;     Pair( Object first, Object second ) {         this.first = first;         this.second = second;     } } public class Quiz {     public static void main( String[] args ) {         Singleton s;         Pair p1, p2;         s = new Singleton( 99 );...

  • 2. Write a counter controlled loop to solve the following problems. Each one will involve an...

    2. Write a counter controlled loop to solve the following problems. Each one will involve an array (MinMax.java) Read in 25 ints from the keyboard, and store them in an array. Then, find the maximum and minimum values in such an array, and display them on the screen. public class Array-Assignment { public static void main(String [] args) {     int [] x = new int[3];     int [] y = {3, 5, 9, 2};     x[2] = y[3];    ...

  • C#, I am getting error placing them all in one file pls set them in the...

    C#, I am getting error placing them all in one file pls set them in the order that all 3 work in one file. Thanks //Program 1 using System; class MatrixLibrary { public static int[,] Matrix_Multi(int[,] a, int [,]b){ int r1= a.GetLength(0); int c1 = a.GetLength(1); int c2 = b.GetLength(1); int r2 = b.GetLength(0); if(r2 != c2){ Console.WriteLine("Matrices cannot be multiplied together.\n"); return null;    }else { int[,] c = new int[r1, c2]; for (int i = 0; i <...

  • 6. (4 points) The following code for insertion sort has been modified to print out the...

    6. (4 points) The following code for insertion sort has been modified to print out the sorted component of the array during the sort. What will be the output of running the main method of the following code? Try to trace by hand and then verify by executing the code public class Insertion ( public static void sort (String[] a) f int n- a.length; for (int i-1; i < n; i++) f for (int j i; j 0; j--) if...

  • Below I have my 3 files. I am trying to make a dog array that aggerates...

    Below I have my 3 files. I am trying to make a dog array that aggerates with the human array. I want the users to be able to name the dogs and display the dog array but it isn't working. //Main File import java.util.*; import java.util.Scanner; public class Main {    public static void main(String[] args)    {    System.out.print("There are 5 humans.\n");    array();       }    public static String[] array()    {       //Let the user...

  • the answer must be in java. thank you Question 2 [8 points] Consider the class Class...

    the answer must be in java. thank you Question 2 [8 points] Consider the class Class A below: class Class A implements Serializable{ int a; static int b; transient int c; String s; // Constructor public Class A (int a, int b, int c, Strings){ this.a = a; this.b = b; this.c = c; this.s = s; Complete the class Test to test the serialization and deserialization of the objects of class Class A. State the possible variable values following...

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
ADVERTISEMENT