Answer:
Explanation:
namespace Jeroen\ReviewIntegration\Observer;
use Magento\Framework\Event\ObserverInterface;
class ProductReview implements ObserverInterface
{
protected $_storeManager;
protected $_request;
public function __construct(
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Framework\App\Request\Http $request
) {
$this->_storeManager = $storeManager;
$this->_request = $request;
}
public function execute(\Magento\Framework\Event\Observer $observer)
{
return 'test';
}
}
Prison or juvenile detention of course, its a violation
Answer:
Stack.
Explanation:
Topological sort requires a bit of addition to DFS algorithm.So DFS can be done by two ways that are either you can use recursion or you can use Stack data structure to implement DFS.
Since recursion uses stack memory when it makes recursive calls and if you want to do it iteratively you can stack data structure.
Answer:
import java.util.Scanner;
public class num8 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter month's budget");
double monthBudget = in.nextDouble();
double totalExpenses = 0.0;
double n;
do{
System.out.println("Enter expenses Enter zero to stop");
n = in.nextDouble();
totalExpenses += n;
}while(n>0);
System.out.println("Total expenses is "+totalExpenses);
System.out.println("The amount over your budget is "+ Math.abs(monthBudget-totalExpenses));
}
}
Explanation:
- Using Java programming language
- Prompt user for month's budget
- Use Scanner class to receive and store the amount entered in a variable
- Use a do while loop to continuously request user to enter amount of expenses
- Use a variable totalExpenses to add up all the expenses inside the do while loop
- Terminate the loop when user enters 0 as amount.
- Subtract totalExpenses from monthBudget and display the difference as the amount over the budget
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.