Write a Python program that takes a number from the user and prints its digits from left to right.
[Consider the input number to be an INTEGER. You are not allowed to use String indexing for solving this task]
=========================================================================
Example: if the user gives 32768, then print 3, 2, 7, 6, 8
Write a Python program which takes a number and prints the digits from the unit place, then the tenth, then hundredth, etc. (Right to Left)
[Consider the input number to be an INTEGER. You are not allowed to use String indexing for solving this task]
Example: If the user gives 32768, then print 8, 6, 7, 2, 3
First, read in an input value for variable numVals. Then, read numVals integers from input and output each on the same line with the character ", " between each value. End with a newline.
Note: ", " should not be at the beginning or end of the output.
Ex: If the input is 4 -60 -35 -15 -45, the output is:
-60, -35, -15, -45
Implement a c# method CalculateCourseFee(double courseFee, double marks, double serviceFee) to calculate the total fees to be paid by a student.
The students are entitled to get scholarship based on the marks scored in the qualifying exam. Scholarship percentage should be considered as half of the marks scored by the student on the course fee. Apart from the course fee(after deducting the scholarship amount), the students have to pay extra service fees.
Assume that the marks is out of 100 and need not always be integer.
Write a python function that accepts a list of numbers and try to find out the value of a ‘magic index’. The ‘magic index’ is calculated as the ratio of the largest and smallest list element. The python function Magic_Index(A) Take a list of elements and return the value of the magic index or error message for any possible exceptions. The error message will be "error occurred = error name".
Example-1
Example-2
Example-3
Input:
[1, 2, 0]
Output:
Division Error: division by zero
Input:
[1, 2, 3, 6]
Output:
6.0
Input:
[1, 2, 0, "x"]
Output:
Other Error: '>' not supported between instances of 'str' and 'int'
Write a FaceConnect program that has the ff module:
NOTE: ALL info must be saved in text files.
The ff are the textfiles:
userCredentials - where the data of registered users will be written.
Format:
username;password;firstname;lastname;birthdate
e.g
prettyME;1234;Rhea;Tortor;12/25/1990
Each user has its own textfile where his/her friend(s) info will be written. use the username as the filename of each file.
The content of each file follow below format:
username1;[username2];[username3];
A company is offering a special discount to its customers based on an algorithm. Two range values are fed to the algorithm and in return t will calculate the discount to offer to the customers. The discount is calculated as the sum of all the prime numbers within the defined range including the range values if the range values are the prime numbers
Write an algorithm to find the special discount given to the customers
Input
The first line of the input consists of
an integer-rangelet remeng
the minimum boundary wabererte
given range
Write a program to test your
class. Use integer variables to represent the private instance variables of the class—the numerator and
the denominator. Provide a constructor that enables an object of this class to be initialized when it’s
declared. The constructor should store the fraction in reduced form. The fraction:
2/4 is equivalent to 1/2 and would be stored in the object as 1 in the numerator and 2 in the denominator.
Provide a no-argument constructor with default values in case no initializers are provided. Provide public
methods that perform each of the following operations:
Add two Rational numbers: The result of the addition should be stored in reduced form.
Subtract two Rational numbers: The result of the subtraction should be stored in reduced form.
Multiply two Rational numbers: The result of the multiplication should be stored in reduced
form.
Also, write a test program to test all methods, and provide the UML class diagram of your class.
Create class SavingsAccount. Use a static variable annualInterestRate to store the annual
interest rate for all account holders. Each object of the class contains a private instance variable
savingsBalance indicating the amount the saver currently has on deposit. Provide method
calculateMonthlyInterest to calculate the monthly interest by multiplying the
savingsBalance by annualInterestRate divided by 12—this interest should be added to
savingsBalance. Provide a method modifyInterestRate that sets the
annualInterestRate to a new value.
Write a program to test class SavingsAccount. Instantiate two savingsAccount objects, saver1
and saver2, with balances of $2000.00 and $3000.00, respectively. Set annualInterestRate to
4%, then calculate the monthly interest for each of 12 months and print the new balances for both savers.
Next, set the annualInterestRate to 5%, calculate the next month’s interest and print the new
balances for both savers. Also, provide the UML class diagram of your class.
Find perimeter of a matrix
Input1:
1 2 3
4 5 6
7 8 9
Output: 40
Input2:
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
Output: 102