Answer:
come help me on my last question please
Explanation:
Answer:
#include <iostream>
using namespace std;
double DrivingCost(int drivenMiles,double milesPerGallon,double dollarsPerGallon)
{
double dollarsperMile=dollarsPerGallon/milesPerGallon;//calculating dollarsperMile.
return dollarsperMile*drivenMiles;//returning thr driving cost..
}
int main() {
double ans;
int miles;
cout<<"Enter miles"<<endl;
cin>>miles;
ans=DrivingCost(miles,20.0,3.1599);
cout<<ans<<endl;
return 0;
}
Output:-
Enter miles
10
1.57995
Enter miles
50
7.89975
Enter miles
100
15.7995
Explanation:
In the function first I have calculated the dollars per mile and after that I have returned the product of dollarspermile and driven miles.This will give the cost of the Driving.
Answer:
// here is code in c++.
// include header
#include <bits/stdc++.h>
using namespace std;
// main function
int main()
{
// variables to read input
int userNum,x;
cout<<"enter the value of userNum and x :";
// read the input from user
cin>>userNum>>x;
// divide the userNum with x 4 times
for(int a=0;a<4;a++)
{
userNum=userNum/x;
cout<<userNum<<" ";
}
cout<<endl;
return 0;
}
Explanation:
Declare two variables "userNum" and "x". Read the value of these. Run a for loop 4 time and divide the "userNum" with "x" and print the value of "userNum".
<u>Output:</u>
enter the value of userNum and x :2000 2
1000 500 250 125
Answer:
The printItem() method code is filled in the explanation, highlighted with bold font.
Explanation:
// ===== Code from file BaseItem.java =====
public class BaseItem {
protected String lastName;
public void setLastName(String providedName) {
lastName = providedName;
return;
}
// FIXME: Define printItem() method
/* Your solution goes here */
public void printItem() {
// TODO Auto-generated method stub
System.out.println("Last name: "+lastName);
}
}
// ===== end =====
D is the answer to that problem