New course! Every coder should learn Generative AI!
Try a free lessonQ&A Discussions
public class Vehicle {
int maxSpeed;
int wheels;
String color;
double fuelCapacity;
void horn() {
System.out.println("Beep!");
}
}
class MyClass {
public static void main(String[ ] args) {
Vehicle v1 = new Vehicle();
Vehicle v2 = new Vehicle();
v1.color = "red";
v2.horn();
System.out.println(v1);
}
}
Explain its outcome. I am unable to get the last line of outcome.
-1 Vote
2 Answersstrings double quota
-1 Vote
3 Answerswhat is double ???
0 Votes
2 Answersdouble semicolon.
1 Vote
3 AnswersFloat vs. Double?
1 Vote
5 AnswersWrite and test a program that solves quadratic equations. A
quadratic equation is an equation of the form ax2+ bx + c =0 ,where a,b and c are given coefficient and x is the unknown The coefficients are real number inputs ,so they should be declared of type float or double Since quadratic equations typically have two solutions ,use x1 and x2 for the solutions to be output These should be declared of type double to avoid inaccuracies from round-off error
-1 Vote
3 Answers#include <iostream>
using namespace std;
class employee
int main()
{
private:
double salary;
public:
void getsalary(double sal)
{
salary=sal;
}
void display()
{
cout<<"the salary:"<<salary;
}
};
void main ()
{
employee programmer;
employee manager;
manager.getsalary (60000.0);
programmer.getsalary(40000.0);
manager.display();
programmer.display();
return 0;
}
1 Vote
5 Answersdouble darr?
-2 Votes
8 AnswersHot today
Remove from a slice of a list
2 Votes
Questions
1 Votes
Why it's giving error
3 Votes
HTML CSS - Filter: brightness()
0 Votes
Questions
0 Votes
String methods
1 Votes
Collection
0 Votes
xampp
0 Votes