answer.
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
MArishka [77]
2 years ago
5

Assign courseStudent's name with Smith, age with 20, and ID with 9999. Use the printAll() member method and a separate println()

statement to output courseStudents's data. Sample output from the given program:
Computers and Technology
1 answer:
vekshin12 years ago
4 0

Answer:

Following are the program in the java language  

public class Main // Main class  

{

   String courseStudentsname; // variable declaration  

   int age; // variable declaration  

   int ID; // variable declaration  

   Main() // default constructor

   {

courseStudentsname="Smith";//assign the values mention in the question              

       age=20;//assign the values which is mention in the question  

       ID=9999;//assign the values which is mention in the question    

   }

void printAll() // method definition of printAll()  

   {

      System.out.print("Name: " + courseStudentsname ); // display name

      System.out.print(", Age: " + age); // display age

      System.out.print(", ID: " + ID); // display id

   }

public static void main(String[] args) // main fuunction()

{

Main ob=new Main(); // create the object of Main class  

ob.printAll(); // calling the method printAll()

}

}

Output:

Name:"Smith, Age:20, ID:9999

Explanation:

Following are the description of program

  • Create a constructor of "Main" class and store the respective values of courseStudentsname,age and ID in that constructor .
  • create a method printAll() and print the respective values in the given format which is mention in the question by using   System.out.print method.
  • In the main function create an object of "Main" class i.e "ob".
  • Finally, call the printAll() method by using the object of Main class.

You might be interested in
A domain's ____ settings must be configured correctly so that the mail transfer agent (mta) can establish a connection with a re
Oksi-84 [34.3K]

i think its firewall. Because the firewall can block protocols are are not allowed by an administrator. especially over a remote connection

5 0
2 years ago
Write c++ program bmi.cpp that asks the user bmi.cpp the weight (in kilograms) and height (in meters).
Galina-37 [17]

Answer:

// here is code in C++(bmi.cpp).

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

   // variables

float weight,height;

cout<<"enter the weight(in kilograms):";

//read the weight

cin>>weight;

cout<<"enter the height(in meters):";

//read the height

cin>>height;

// calculate the bmi

float bmi=weight/(pow(height,2));

// print the body-mass index with two decimal places

cout<<"BMI is: "<<fixed<<setprecision(2)<<bmi<<endl;

return 0;

}

Explanation:

Read the weight from user and assign it to variable "weight",read height and assign it to variable "height".Then find the body-mass index as (weight/height^2).Here weight  should be in kilograms and height should be in meters.

Output:

enter the weight(in kilograms):75

enter the height(in meters):1.8

BMI is: 23.15

8 0
2 years ago
Sang ayon kaba sa pahayag na walang sinuman ang nabubuhay para sa sarili lamang? bakit?
d1i1m1o1n [39]
What language is this?
7 0
2 years ago
Which change signaled a musical progression toward rock and roll?
postnew [5]
It is the inclusion of the bass section
7 0
2 years ago
Write a program that repeatedly reads in integers until a negative integer is read. The program keeps track of the largest integ
vfiekz [6]

Answer:

In Python:

num = int(input("Enter number: "))

maxn = num

while num >=0:

   if num>maxn:

       maxn = num

   num = int(input("Enter number: "))

print("Largest: "+str(maxn))

Explanation:

Get input from the user

num = int(input("Enter number: "))

Initialize the largest to the first input

maxn = num

This loop is repeated until a negative input is recorded

while num >=0:

If the current input is greater than the previous largest

   if num>maxn:

Set largest to the current input

       maxn = num

Get another input from the user

   num = int(input("Enter number: "))

Print the largest

print("Largest: "+str(maxn))

5 0
2 years ago
Other questions:
  • A network design engineer has been asked to design the IP addressing scheme for a customer network. The network will use IP addr
    6·1 answer
  • Implement a class MyInt() that behaves almost the same as the class int, except when trying to add an object of type MyInt. Then
    11·1 answer
  • The effectiveness of a(n) _____ process is essential to ensure the success of a data warehouse. Select one: a. visual basic b. e
    15·2 answers
  • What statement best describes Konrad Zuse?
    6·2 answers
  • When using the following symbol, there are two arrows coming out of it. One arrow corresponds to what happens in the program if
    7·1 answer
  • Justin signed a rental agreement for his new condo. How long is his lease? a p e x
    15·1 answer
  • Enter a nested function in cell G8 that displays the word Flag if the Payment Type is Credit and the Amount is greater than or e
    9·1 answer
  • E xercise 17.2.4: The following is a sequence of undo-log records written by two transactions T and U: &lt; START T&gt;; ; &lt;
    15·1 answer
  • php Exercise 3: Function Write a function named word_count that accepts a string as its parameter and returns the number of word
    5·1 answer
  • How to code 2.9.5: Four colored triangles {Code HS}
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!