Programming & Computer Science Answers

C++ 9913
Python 5288
Java | JSP | JSF 3611
C 1680
C# 1362
Computer Networks 989
Algorithms 652
Databases | SQL | Oracle | MS Access 641
HTML/JavaScript Web Application 588
Other 537
Visual Basic 358
Assembler 209
Software Engineering 202
AJAX | JavaScript | HTML | PHP 166
MatLAB 150
MatLAB | Mathematica | MathCAD | Maple 124
Action Script | Flash | Flex | ColdFusion 112
UNIX/Linux Programming 89
Web Development 73
Excel 36
ASP | ASP.NET 23
Delphi | Pascal 21
Perl 16
Prolog 9
Functional Programming 9
MathCAD 5
Wolfram Mathematica 4
WPF 4
Ruby | Ruby on Rails 3
NodeJS Web Application 2

Questions answered by Experts: 26 876

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

Create a simple calculator application in Java which will perform four basic



arithmetic operations (plus, minus, multiplication and division) on a pair of



numbers (input from user) from 0 – 9, except division by zero. It means, this



program will perform arithmetic operations between single digits only, but the



result can be more than one digit and in decimals, obviously. Sample output is



given below:



Enter first number between 0 and 9: 6



Enter second number between 0 and 9: 4



Applying arithmetic operations:



Adding 6 and 4 results = 10



Subtracting 4 from 6 results = 2



Multiplying 6 with 4 results = 24



Dividing 6 by 4 results = 1.5

You are given number stored in variable with the name number multiply the number stored in the variable by 50 and print the result obtained.

INPUT is the first and the only line of the input contains the number stored in the variable

Constraints 1<=N=> 20


Use a one-dimensional array to solve the following problem. Read in 20 numbers, each of which is between 10 and 100, inclusive. As each number is read, validate it and store it in the array


only if it isn’t a duplicate of a number already read. After reading all the values, display only the unique values that the user entered.



Create a class called Complex to represents complex numbers. Complex class contains following members





1. Two private float data members such as real and imag.





2. Two public member function such as read() to read input for complex numbers from user and print() to print the complex numbers(refer sample output for output format).





3. Two operator functions:





First operator function(it should be friend) is overloading the binary operator + to add and return two complex objects.





Second operator function is overloading the greater than operator(>) to check whether object1 is greater than object2. If object1 is greater than object2, then return true otherwise return false.

list of lists that has the first number as the same number given in the input list and the second number be the square of the first number.

When will the ‘while’ loop be preferred over the for loop? Mention the scenario and write the


programme to demonstrate this.



write a python function Square_List(A)  that takes a list as an input and returns another list of lists that has the first number as the same number given in the input list and the second number be the square of the first number.[[1, 1], [2, 4], [5, 25], [6, 36]]


Write a Class FeeCalculator that’s programed against FeeStructure (or uses FeeStructure Interface) having the following members

Fields: feeStructure

Constructor (using dependency injection -> constructor injection)

Methods:

  • ·   double calculate(int creditHour, String type )
  • ·  double calculate(int creditHour, String type, int discount )

Write two complete classes (FeeStructur2020 & FreeStructur2021) that implements FeeStructure interface

Suppose:

FeeStructure2020 calculates the fee based on the following

  • · PKR 4,100 per creditHour when type is set to “theory”
  • · PKR 12,250 per creditHour when type is set to “lab”

FeeStructure2021 calculates the fee based on the following

  • ·  PKR 4,600 per creditHour when type is set to “theory”
  • ·  PKR 13,750 per creditHour when type is set to “lab”

Let A=[4, 5, 6, 5, 3, 2, 8, 0, 4, 6, 7, 8, 4, 5, 8, 9, 8, 6, 8, 5, 5, 4, 2, 1, 9, 3, 3, 4, 6, 4] be a list. You need to write a python function Create_List(A) to create a new two-dimensional list B=[[ , ], [ , ], ...., [ , ]] such that for an element [x, y] in B, x denote a value of an element in A and y denotes how many times x appeared in list A. The function Create_List (A) will take list A as input and return list B as an output




NOTE:




Do not use the input() function for taking input from the keyboard. Specify the input in fixed form but function must be generalized that can work with values.



you are not allowed to use extra lists other than A and B. Further, no predefined functions are allowed except len(), and append().

LATEST TUTORIALS
APPROVED BY CLIENTS