Answer:
public static void printFeetInchShort(int numFeet, int numInches) {
System.out.println(numFeet+"\'"+ numInches+"\"");
}
Explanation:
To format the output properly, make use of the excape sequences (\' and \'') with string concatenation.
The complete code is given below:
public class StringLength {
public static void printFeetInchShort(int numFeet, int numInches) {
System.out.println(numFeet+"\'"+ numInches+"\"");
}
public static void main(String[] args) {
printFeetInchShort(5, 8);
System.out.println("");
}
}
Answer:
Follows are the code to this question:
#include <iostream>//defining a header file
using namespace std;
int roll()//defining a method roll
{
return 1+(rand() %5);//use return keyword that uses a rand method
}
int main()//defining main method
{
cout<<roll();//calling roll method that print is value
return 0;
}
Output:
4
Explanation:
In this code, the "roll" method is defined, that uses the rand method with the return keyword, that returns the value between 1 to 6, and in the next step, the main method is declared, that uses the print method to calls the roll method.
Answer:
The following are the four difference between the fourth and the fifth generation of the computer that are:
- The fourth generation computer technology is basically based of the microprocessor. On the other hand, the fifth generation computer is based upon the artificial intelligence technology.
- The fourth generation computer system are faster in computation. Whereas, the fifth generation computer are more reliable and faster in speed as compared to all other generations.
- The fifth generation computer are small in the size and more potable as compared to the fourth generation computer system.
- Laptop, notebook and Chromebook are some of the example of fifth generation. Whereas, STAR 100 and IBM 4341 are the example of fourth generation.
Answer:A robot is a programmable mechanical device that can perform tasks and interact with its environment, without the aid of human interaction. Roboticsis the science and technology behind the design, manufacturing and application of robots. The word robot was coined by the Czech playwright Karel Capek in 1921.
Explanation:
Answer:
The name of a .java file should <u>always match the name of the class inside.</u>
Explanation:
In Java programming the program written in code editor is first saved with .java extension. The name of this .java file should be same as that of the class declared inside the file.
This .java file is then compiled and converted to .class file which contains the java bytecode. This bytecode can then be executed by java virtual machine(JVM).
However it is not always necessary that name of .java files should be same as that of class inside it. The name should be same only when the class inside is declared as public.
In case it is not declared as public one can name .java file different than the actual class name.