Answer:
<em>C++.</em>
#include <iostream>
using namespace std;
////////////////////////////////////////////////////////////////
int main() {
int weekly_hours = 0;
int hourly_rate;
float gross_pay = 0;
cout<<"Enter weekly hours worked: ";
cin>>weekly_hours;
cout<<"Enter hourly rate: ";
cin>>hourly_rate;
cout<<endl;
////////////////////////////////////////////////
if (weekly_hours > 40) {
gross_pay = (weekly_hours*hourly_rate) + ((weekly_hours*hourly_rate)*0.5);
}
else
gross_pay = weekly_hours*hourly_rate;
cout<<"Weekly gross pay: $"<<gross_pay;
////////////////////////////////////////////////
return 0;
}
Answer:
See explaination
Explanation:
#include <iomanip>
#include <string>
#include <fstream>
using namespace std;
void getName(string);
void getPin(int,int);
void displayMenu(int);
string name;
int pin1, pin2, ch ;
int main()
{
cout << fixed << showpoint << setprecision(2);
getName(name);
getPin(pin1,pin2);
displayMenu(ch );
system("pause");
}
void getName(string name)
{
cout << "Enter your name: ";
cin >> name;
if (name = "AXBY") || (name != "ABGSHY"))
{
getName(name);
}
}
void getPin(int pin1, int pin2)
{
string name;
if (name == "AXBY")
{
cout << "Please Enter Pin: ";
cin >> pin1;
if (pin1 != 4433)
{
cout << "Pin incorrect please try again!";
cin >> pin1;
}
}
if (name == "ABGSHY")
{
cout << "Please Enter Pin: ";
cin >> pin2;
if (pin2 != 2849)
{
cout << "Pin incorrect please try again!";
cin >> pin2;
}
}
}
void displayMenu(int ch )
{
cout << "[1] Check your account Balance\n"
"[2] Withdraw funds\n"
"[3] Deposit funds\n"
"Please Enter Choice: ";
cin >> ch ;
if (ch != 1 || ch != 2 || ch != 3)
{
cout << "Choice is incorrect, enter choice now: ";
cin >> ch ;
}
}
Answer:
The Matlab code is as given in the explanation, paste the code in the new script file, save it and run.
Explanation:
The code is as follows
Code:
<em>%% Initialization of the code</em>
<em>% The code takes an array of six AIS scores of the form [AIS1 AIS2 AIS3</em>
<em>% AIS4 AIS5 AIS6] of order 1x6.</em>
<em>AIS=input('Please enter the AIS array of the form [AIS1 AIS2 AIS3 AIS4 AIS5 AIS6]');%taking input of the array</em>
<em>AISs=sort(AIS,'descend');%sorting the array in the descending order</em>
<em>iss=(AISs(1,1)^2)+(AISs(1,2)^2)+(AISs(1,3)^2);%Calculating the ISS</em>
<em>disp(['The injury severity score (ISS) for the entered array is ', num2str(iss)])%Displaying the output</em>
Output:
<u><em>Please enter the AIS array of the form [AIS1 AIS2 AIS3 AIS4 AIS5 AIS6][3 0 4 5 3 0];</em></u>
<u><em>The injury severity score (ISS) for the entered array is 50</em></u>
<u><em /></u>