Answer:
def floor_sum(number1, number2):
total = number1 + number2
if total >= 0:
return int(total)
else:
return int(total) - 1
print(floor_sum(1.1, 3.05))
Explanation:
*The code is in Python.
Create a function called floor_sum that takes two parameters, number1 and number2
Sum them and set it to the total
Check if the total is positive number or 0, return the integer part of the total. Otherwise, subtract 1 from the integer part of the total and return it.
Call the function with given parameters in the question and print the result
Note that if the result is a negative value like -5.17, the floor of the result is -6 not -5.
Answer:
C++ code is given below
Explanation:
#include<iostream>
#include <cstring>
using namespace std;
int housekeeping(string EOFNAME);
int mainLoop(string name,string EOFNAME);
int finish();
void main()
{
string name;
string EOFNAME = "ZZZZ";
cout << "enter the name" << endl;
cin >> name;
if (name != EOFNAME)
{
housekeeping(EOFNAME);
}
if (name != EOFNAME)
{
mainLoop(name , EOFNAME);
}
if (name != EOFNAME)
{
finish();
}
system("pause");
}
int housekeeping(string EOFNAME)
{
cout << "enter first name " << EOFNAME << " to quit " << endl;
return 0;
}
int mainLoop(string name, string EOFNAME)
{
int hours;
int rate,gross;
int DEDUCTION = 45;
int net;
cout << "enter hours worked for " << name << endl;
cin >> hours;
cout << "enter hourly rate for " << name << endl;
cin >> rate;
gross = hours*rate;
net = gross - DEDUCTION;
if (net > 0)
{
cout << "net pay for " << name << " is " << net << endl;
}
else
{
cout << "dedections not covered.net is 0.";
}
cout << "enter next name or " << EOFNAME << " to quit" << endl;
cin >> name;
return 0;
}
int finish()
{
cout << "end of job"<<endl;
return 0;
}
Answer:
a). SLE =$37.5
b). ARO =75
c). ALE = $2,812.5
Explanation:
a).Single loss Expectancy (SLE) is starting point in determining the single loss of an asset that will occur and calculated this;
SLE = asset value * exposure factor.
Asset value =$500,
Exposure factor is simply the percentage of asset lost.
In this case out of 1000 phones, 75 were damaged or loss.
In percentage;
75 ÷ 1000 =0.075, 0.075×100=7.5%(exposure factor).
Therefore,
SLE = $500×7.5%= $37.5.
b). ARO - Annual Rate of Occurrence is the number of times a threat on a single asset is expected to occur in one year.
In the case the damage or loss occured in 75 devices in one year.
c). ALE - Annualized loss Expectancy is the product of SLE and ARO.
Therefore;
ALE = $37.5 × 75 = $2,812.5.