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
ch4aika [34]
3 years ago
13

Write a program that takes a decimal number from the user and then prints the integer part and the decimal part separately. For

example, if the user enters 2.718, the program prints: Integer part = 2 and decimal part = .718 in python
Computers and Technology
1 answer:
svp [43]3 years ago
7 0

Answer:

Explanation:

The following was coded in Python as requested. It is a function that takes in a number as a parameter. It then uses the Python built-in math class as well as the modf() method to split the whole number and the decimal, these are saved in two variables called frac and whole. These variables are printed at the end of the program. The program has been tested and the output can be seen below.

import math

def seperateInt(number):

   frac, whole = math.modf(number)

   print("Whole number: " + str(math.floor(whole)))

   print("Decimals number: " + str(frac))

You might be interested in
Ava is at her first job interview, and the interviewer asks her a difficult question she hasn't prepared to answer. What should
lidiya [134]

Answers: It's A. Or C. sorry that the best i got

Explanation:

7 0
3 years ago
Read 2 more answers
Use the Internet to gather information on four filesystems compatible with Linux. For each filesystem, list the situations for w
marta [7]
If fhun gftrfjjtcbjjbsufcghtfghyrssfbkoire crazy ahh young man
7 0
4 years ago
________ tv uses a digital signal, or series of 0s and 1s, and is much clearer and less prone to interference than analog tv. re
vagabundo [1.1K]
Digital TV uses a digital signal, or series of 0s and 1s, and is much clearer and less prone to interference than analog TV.<span> It improves reception, offers better picture and sound quality, </span>
In analog television, in which the video and audio are carried by analog signals. In digital they are carried with digital encoding. 
4 0
4 years ago
Given ProblemSolution class. Use a pointer to object of "ProblemSolution" class to invoke the "CalculateSum" and "Print" methods
faltersainse [42]

Answer:

#include <iostream>

using namespace std;

class  ProblemSolution {

private:

int num1, num2;

public:

ProblemSolution(int n1, int n2) {

 num1 = n1;

 num2 = n2;

}

int calculateSum() {

 int sum = 0;

 sum = num1 + num2;

 return sum;

}

void printSum() {

 // calculateSum will return sum value that will be printed here

 cout <<"Sum = "<< calculateSum();

}

~ProblemSolution() {

 cout << "\nDestructor is called " << endl;

};

};

int main() {

int a, b;

cout << "Enter a: ";

cin >> a;

cout << "Enter b: ";

cin >> b;

// Initiallizing object pointer of type ProblemSolution

ProblemSolution *objPtr = new ProblemSolution(a,b);

// printing Sum

objPtr->printSum();

// delete objPtr to relaease heap memory :important

delete objPtr;

return 0;

}

Explanation:

we will initialize  a pointer "objPtr" and initallize the constructor by passing 2 values a and b followed by the keyword  "new". the keyword "new" allocates memory in the heap. we can access class member functions using arrow "->". it is important to delete objPtr at the end of the program so that the heap memory can be freed to avoid memory leakage problems.  

3 0
3 years ago
When you choose a(n) ___________ installation, you only install selected features, rather than all of the features associated wi
lisabon 2012 [21]

Answer:

When you choose a(n) <em><u>custom</u></em> installation, you only install selected features, rather than all of the features associated with a software program.

Explanation:

There are two types of installation while installing a software

1. Default

2. Custom

In default installation, all the features of a software program are installed while when the custom installation mode is selected, the user can select which features of the software he wants to install instead of all features.

So,

When you choose a(n) <em><u>custom</u></em> installation, you only install selected features, rather than all of the features associated with a software program ..

8 0
3 years ago
Other questions:
  • Tanya is entering the amount of money she has earned from babysitting onto an Excel spreadsheet, but the AutoComplete feature is
    9·2 answers
  • Regional culture has been affected by technology in these ways. Select all that apply. decreased educational opportunities impro
    9·2 answers
  • TCP has a 32-bit sequence number field and 16-bit advertised window field. Assume that RTT is 512 (2 9 ) ms, transmission speed
    6·1 answer
  • Which of the following queries can have a Fully Meets result? Select all that apply. True False [adobe website], English (US) Tr
    7·1 answer
  • Which of the following lists contains the five essential elements of a computer?
    5·1 answer
  • Although heart rate increases and decrease depending upon activity level on average a typical person heart rate is about _____ b
    10·1 answer
  • A palindrome is a word or a phrase that is the same when read both forward and backward. Examples are: "bob," "sees," or "never
    7·1 answer
  • What type of link is used to call this file shown below?
    5·1 answer
  • The degree to which a firewall can impose user access restrictions is known as which of the following?Security assurancePrivileg
    8·1 answer
  • Without net neutrality, which of these situations might occur? (Select all that apply.) a cable company might charge different b
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!