answer.
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
Black_prince
1 month ago
13

The fractional_part function divides the numerator by the denominator, and returns just the fractional part (a number between 0

and 1). Complete the body of the function so that it returns the right number. Note: Since division by 0 produces an error, if the denominator is 0, the function should return 0 instead of attempting the division.
Computers and Technology
2 answers:
Amiraneli [921]1 month ago
5 0

Response:

import math

def fractional_part(num, den):

   if den == 0:

      return 0

   return num / den - math.floor(num / den)

print(fractional_part(5,4)) // outputs 0.25

print(fractional_part(6,4)) // outputs 0.5

print(fractional_part(12,0)) // outputs 0

Details:

  • Using Python:
  • Importing math (enables access to the math.floor method)
  • An if statement checks for a zero denominator
  • Finding the fractional part is done by subtracting the floor of the result from the complete division.
ivann1987 [930]1 month ago
5 0

Answer:

def fractional_part(numerator, denominator):

  if denominator == 0:

      return 0

  else:

      return (numerator / denominator) % 1

Explanation:

You might be interested in
Define a method calcPyramidVolume with double data type parameters baseLength, baseWidth, and pyramidHeight, that returns as a d
Rzqust [894]

Answer:

The C++ method is defined as follows:

double calcPyramidVolume(double baseLength, double baseWidth, double pyramidHeight){

   double baseArea = calcBaseArea(baseLength, baseWidth);

   double volume = baseArea * pyramidHeight;

   return volume;    

}

Explanation:

This establishes the calcPyramidVolume method

double calcPyramidVolume(double baseLength, double baseWidth, double pyramidHeight){

This invokes the calcBaseArea method to derive the base area of the pyramid

   double baseArea = calcBaseArea(baseLength, baseWidth);

This calculates the volume based on the base area

   double volume = baseArea * pyramidHeight;

This yields the calculated volume

   return volume;  

}

Refer to the attached document for the complete program that includes all required methods.

5 0
24 days ago
A large organization is struggling to close the gaps in skill levels that exist between its employees and those from competing c
ivann1987 [930]

Answer:

C.) by enabling employees to train and enhance skills for more advanced work

Explanation:

Hope this provides assistance!

3 0
24 days ago
Write an if-else statement to describe an integer. Print "Positive even number" if isEven and is Positive are both true. Print "
Harlamova29_29 [932]

Answer:

Below is the explanation for the C code.

Explanation:

#include <stdio.h>

#include <stdbool.h>

int main(void) {

int userNum;

bool isPositive;

bool isEven;

scanf("%d", &userNum);

isPositive = (userNum > 0);

isEven = ((userNum % 2) == 0);

if(isPositive && isEven){

  printf("Positive even number");

}

else if(isPositive &&!isEven){

  printf("Positive number");

}

else{

  printf("Not a positive number");

}

printf("\n");

return 0;

}

6 0
1 month ago
A retailer is able to track which products draw the most attention from its customers through the use of 5g-enabled motion senso
zubka84 [945]

The technology that integrates with 5g capabilities for tracking shopping trends is known as the internet of things.

To clarify, let's define internet of things.

  • The internet of things refers to a network of Internet-enabled objects, often utilizing web services for interaction.
  • There has been a notable development in the Internet where devices maintain network connectivity, allowing them to transmit and receive data.

Based on this explanation, we can affirm that the assertion regarding the technology using 5g capabilities for monitoring shopping behaviors being labeled as internet of things is accurate.

Find out more about internet of things here:

7 0
28 days ago
Dairy Farm decided to ship milk in containers in the form of cubes rather than cylinders. Write a program called ws4.cpp that pr
Harlamova29_29 [932]

Answer:

1. #include <iostream>

2. #include <cmath>

3.  

4. using namespace std;

5.  

6. int main()

7. {

8.     float radius;  

9.     cout << "Type the radius of the base: "; // Input a number

10.     cin >> radius; // Capture user input

11.      

12.     float height;  

13.     cout << "Type the height: "; // Enter a number and press enter

14.     cin >> height; // Get user input

15.      

16.     float volumeCylinder = 3.1416 * radius * radius * height;

17.     float cubeSide = std::pow(volumeCylinder, 1/3.);

18.     cout<<"Cube side is: "<< cubeSide;

19.      

20.     return cubeSide;

21. }

Explanation:

  • Lines 1 to 5 observe two libraries
  • Lines 6 to 7 declare the main function
  • Lines 8 to 11 solicit the radius of the cylinder from the user
  • Lines 12 to 15 request the user to input the cylinder's height
  • Line 16 calculates the cylinder's volume with the formula        V=pi*(r^2)*h
  • Line 17 computes the side length of a cube with a matching volume as the cylinder using side=∛(V)
  • Lines 18 to 21 display and return the cube's side length
Download cpp
3 0
20 days ago
Other questions:
  • Why were the practitioners of alternative software development methods not satisfied with the traditional waterfall method?
    9·1 answer
  • Which of the following statements is true regarding input and output?
    12·2 answers
  • This program outputs a downwards facing arrow composed of a rectangle and a right triangle. The arrow dimensions are defined by
    15·1 answer
  • A have a string, called "joshs_diary", that is huge (there was a lot of drama in middle school). But I don't want every one to k
    5·1 answer
  • An array subscript can be an expression, but only as long as the expression evaluates to what type?
    7·1 answer
  • If a cell reference is c6, this cell is in the sixth column and the third row. true or false
    11·2 answers
  • The principal that users have access to only network resources when an administrator explicitly grants them is called __________
    6·1 answer
  • Write a program that prompts the user to enter three cities and displays them in ascending order. Here is a sample run: Enter th
    8·1 answer
  • The Online Shopping system facilitates the customer to view the products, inquire about the product details, and product availab
    8·1 answer
  • Danielle, a help desk technician, receives a call from a client. In a panic, he explains that he was using the Internet to resea
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!