1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
jeka94
4 years ago
8

In this challenge, write a function to add two floating point numbers. Determine the integer floor of the sum. The floor is the

truncated float value, i.e. anything after the decimal point is dropped. For instance, floor(1.1 + 3.05) = floor(4.15) = 4.
Computers and Technology
1 answer:
Wewaii [24]4 years ago
5 0

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.

You might be interested in
As more and more computing devices move into the home environment, there's a need for a centralized storage space, called a ____
Ksivusya [100]

Answer: Network attached storage device

Explanation:

Network attached storage(NAS) is the data storage server device that is responsible for serving files to configuration and other components.Through this sever device data can be retrieved by various client and user from central disk capacity .It provides good data access to diverse user and client of data.

  • Other options are incorrect because RAID drive, server station, gigabit NIC are not the devices that centrally store huge amount of data for access.
  • Thus, the correct option is network attached storage(NAS) device

8 0
3 years ago
Write an expression using membership operators that prints "Special number" if special_num is one of the special numbers stored
Mashcka [7]

Answer:

In python, the statement can be written as:

<em>if(special_num in special_list): print("Special Number") </em>

Explanation:

We need to create a list with the name 'special_list' with some values and then check whether special_num is in the list or not using the membership operator.

Membership operator in python: <em>in</em>

Let us do it step by step in python:

<em>special_list = ['1', '2', '3','4']      #</em>A list with the values 1, 2, 3 and 4

<em>special_num = input("Enter the number to be checked as special \t") </em>

<em>#</em>Taking the input from the user in the variable special_num.

<em>if(special_num </em><em>in</em><em> special_list): print("Special Number") </em>

#Using the membership operator <em>in </em>to check whether it exists in the list or not.

Please refer to the image attached for the execution of above program.

So, the answer is:

In python, the statement can be written as:

<em>if(special_num in special_list): print("Special Number") </em>

6 0
4 years ago
_________ is the amount of data a storage device can move per second from the storage medium to ram.
mote1985 [20]
<span>data transfer rate..</span>
5 0
4 years ago
You have the following code:
My name is Ann [436]

Answer:

7

Explanation:

We already have the functions that tells us how much to add. If you add all this, you will get 12. HOWEVER because cantaloupe is in the list, the computer does not count that. So if we add that again without 5(how much the cantaloupe costs), we get 7.

3 0
2 years ago
a user's given name followed by the user's age from standard input. Then use an ofstream object named outdata (which you must de
RUDIKE [14]

Answer:

See explaination for program code

Explanation:

#include <iostream>

#include <string>

#include <fstream>

using namespace std;

int main() {

string name;

int age;

cout << "Enter name of user: ";

getline(cin, name);

cout << "Enter age of user: ";

cin >> age;

ofstream outdata("outdata");

outdata << name << " " << age << endl;

outdata.close();

return 0;

}

4 0
3 years ago
Other questions:
  • The following declaration appears in a program: short totalPay, basePay = 500, bonus = 1000; The following statement appears in
    9·1 answer
  • Imagine that you are an independent filmmaker making a feature-length narrative film in the United States, with a variety of bot
    11·2 answers
  • In Rizzati Corp, vice presidents in departments such as engineering, manufacturing, IT, and human resources report directly to t
    15·1 answer
  • Quien invento el primer vehiculo con motor?
    15·2 answers
  • A _____ is a group of two or more devices/computers connected together to allow for the exchange and information and for the sha
    5·2 answers
  • A methods and measurements analyst for Digital Devices needs to develop a time standard for the task of assembling a computer mo
    15·1 answer
  • Which of the following are TRUE? A function can call another function. As long as the function is defined anywhere in your progr
    14·1 answer
  • Cuales son mis fortalezas como estudiantes
    14·1 answer
  • Digital security measures include _____. Select 2 options.
    11·2 answers
  • Can someone compress this ipv6 address? 558c:0000:0000:d367:7c8e:1216:0000:66be
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!