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
Llana [10]
3 years ago
14

Type the correct answer in the box. Use numerals instead of words. If necessary, use / for the fraction bar. What will be the ou

tput of the following code?
class Vehicle public static int counter = 0;
public int printCounter_val ) counter = counter + 1;
return counteri public class test
Vehicle public static void main(String args[l) f Vehicle v1=new vehicle();
v1.printCounter val Vehicle v2=new Vehicle() ;
system.out.printin (v2.printCounter_val )):
The output will be______
Computers and Technology
1 answer:
lord [1]3 years ago
8 0

Answer:

2

Explanation:

The output of the Java program is 2. The public Vehicle class is defined with the class variable 'counter'. When a Vehicle class object is instantiated, the counter variable increments by one.

In the program, the two instances of the class are created, incrementing the counter variable to two, the print statement outputs 2 as the result of the program.

You might be interested in
Which requires large computer memory?
Sav [38]

Answer:

Imaging , Graphics and voice..... requires large computer memory.

Explanation:

5 0
3 years ago
LAB: Praising dates
blsea [12.9K]

Answer:

Explanation:

The following is the entire modified code, it takes in the date as an input and continues changing the dates to the desired format. If the input format is wrong it says "Wrong Format" and requests another input. If -1 is passed as an input the program terminates.

        import java.util.Scanner;

        class DateParser {

public static int getMonthAsInt(String monthString) {

        int monthInt;

        switch (monthString) {

            case "January" :

                monthInt = 1;

                break;

            case "February":

                monthInt = 2;

                break;

            case "March":

                monthInt = 3;

                break;

            case "April":

                monthInt = 4;

                break;

            case "May":

                monthInt = 5;

                break;

            case "June":

                monthInt = 6;

                break;

            case "July":

                monthInt = 7;

                break;

            case "August":

                monthInt = 8;

                break;

            case "September":

                monthInt = 9;

                break;

            case "October":

                monthInt = 10;

                break;

            case "November":

                monthInt = 11;

                break;

            case "December":

                monthInt = 12;

                break;

            default:

                monthInt = 0;

                }

        return monthInt;

       }

        public static void main(String[] args) {

        Scanner scnr = new Scanner(System.in);

               // TODO: Read dates from input, parse the dates to find the one

        // in the correct format, and output in m/d/yyyy format  

 

                String date = "";

                while (!date.equals("-1")) {

                    String month = "";

                    String day = "";

                    String year = "";

                    System.out.println("Enter date:");

                    date = scnr.nextLine();

                    try {

                        year = date.substring((date.length()-4), date.length());

                        if (Character.isDigit(date.charAt(date.length()-8))) {

                            day = date.substring((date.length()-8), date.length()-6);

                            month = date.substring(0, date.length()-9);

                        } else {

                            day = date.substring((date.length()-7), date.length()-6);

                            month = date.substring(0, date.length()-8);

                        }

                        if ((year.length() == 4) && (day.length() > 0) && (day.length() <= 2) && (month.length() >= 3)) {

                            System.out.println(getMonthAsInt(month) + "/" + day + "/" + year);

                        } else {

                            System.out.println("Wrong Format");

                        }

                    } catch (Exception e) {

                        System.out.println("Wrong Format");

                    }

                }    

        }

}

4 0
3 years ago
Create an application that lets the user enter the food charge for a meal at a restaurant. When a button is clicked, the applica
Art [367]

Answer:

Public Class Form1

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

       Dim foodCharge, tax, tip, totalCharge As Double

       foodCharge = Val(TextBox1.Text)

       tax = 0.07 * foodCharge

       tip = 0.15 * 100

       totalCharge = foodCharge + tax + tip

       Label5.Text = tax

       Label6.Text = tip

       Label7.Text = totalCharge

   End Sub

End Class

Explanation:

  1. This is implemented using Visual Basic programming language
  2. Firstly we declared all the variables using DIM key word
  3. Then the calculation for each variable is done according to the specification of the question
  4. On the form (See attached Image) the controls for receiving the user input is created as well as the controls for the output.
  5. See the attached sample run below:

4 0
4 years ago
Write a program that will compare two names. The program prompts the user to enter two names for a comparison. If the names are
asambeis [7]

Answer:

We can use comparison operator 'Equals to' (==) to compare two strings.

Explanation:

We can use conditional statement 'if else' to put conditions. If statement contains boolean expression.If statement is followed by else block. If the boolean expression evaluates to true, then the if block of code is executed, otherwise else block of code is executed.

If we want to compare two strings with uppercase, then we can convert the input strings given by users using ToUpper() string function.

For example,

 string abc;

string uppercase= abc.ToUpper(); // gives ABC as result

I have written a program using c# as a  programming language in a word document and attached the same. Please find. Thank you!

Download doc
5 0
4 years ago
Create a class called MyBoxes with: - 1 instance variable, and array to hold Box objects - a constructor with 1 parameter - the
Veseljchak [2.6K]

Answer:

C++

Explanation:

class MyBoxes {

   private:

       // Pointer to Box object and array size. Required for dynamically creating an array.

       Box* boxes;

       int array_size;

       // Constructor

       MyBoxes(int array_size) {

           self.array_size = array_size;

           boxes = new Box[array_size] ;

       }

   public:

       // Methods

       int emptyspace() {

           int count = 0;

           for (int i=0; i < self.array_size; i++) {

               // Check for null

               if (!boxes[i])

                   count++;

           }

           return count;

       }

       void add(int length, int width, int height) {

           Box box1(length, width, height);

           if (self.emptyspace() == 0)  {

               self.addToArray(box1);

           }

       }

       void print() {

           Box *temporaryBox;

           for (int i=0; i < self.array_size; i++) {

               temporaryBox = boxes[i];

               if (temporaryBox) {

                   cout<<temporaryBox->length<<endl;

                   cout<<temporaryBox->width<<endl;

                   cout<<temporaryBox->height<<endl;

               }

           }

           // Free memory

           delete temporaryBox;  

       }

4 0
4 years ago
Other questions:
  • In a digital drawing program, when an object is highlighted, boxes appear at the sides and corners. These boxes can be grabbed a
    13·1 answer
  • Why is it important to use standard english when applying for a job
    13·2 answers
  • Which of the following commands would I use to begin a new presentation?
    14·1 answer
  • A contact list is a place where you can store a specific contact with other associated information such as a phone number, email
    8·1 answer
  • If Chris has a car liability insurance, what damage would he be covered for
    10·1 answer
  • Which of the following is the easiest way for visitors to learn about a business while visiting a website?
    13·1 answer
  • Assume that strikeCounter has already been declared to be a "pointer to int". Assume further that strikeCounter has been initial
    5·1 answer
  • The art element line is a moving point.<br><br><br> True or False
    15·1 answer
  • A computer projecter is an example of a(n):<br> Input Device<br> Output Device<br> Storage Device
    12·2 answers
  • joe is in the planning stages to make sure that an upcoming company promotion during a major sporting event will not overwhelm h
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!