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 console programs:




Example output:




Enter 5 grades:



90



83



87



98



93



The average is 90.2 and round off to 90.





Input


1. First number

2. Second number

3. Third number

Output

The first three lines will contain message prompts to input the three numbers.

The last line contains the product of the three numbers with 1 decimal place.

Enter·the·first·number:·1.6
Enter·the·second·number:·-2
Enter·the·third·number:·-1
Product·=·3.2






1) What is the output produced by the following code? Explain the code in detail.

int *p1, *p2; 

p1 = new int; 

p2 = new int;

*p1 = 10; 

*p2 = 20; 

cout << *p1 << " " << *p2 << endl; 

p1 = p2; 

cout << *p1 << " " << *p2 << endl; 

*p1 = 30;

cout << *p1 << " " << *p2 << endl;

How would the output change if you were to replace *p1 = 30; with the following? *p2 = 30;


A private String data field named patientName.

b) A private int data field named newID. This value will be automatically incremented with the creation of

each Appointement object. The initial value of newID is 1.

c) A private constant (final) int data field named APPOINTEMENT_ID.

d) A private int data field named dayhe value represents the day of the week from 1 to 5, (1 for Monday, 2

for Tuesday, and so on till Friday).

e) A private int data field named hour. Accepted values are 8, 9, 10, …14

f) A constructor that creates a new appointment with specific patient Name given as argument. Then, the

appointment will be immediately assigned a APPOINTEMENT_ID according to newID.

g) The accessor (getter) methods for patientName and APPOINTEMENT_ID.

h) The accessor and mutator (setter) methods for the day and hour fields. Note that if the day value is not in

[1,5] then the field is set 0. Also, if the hour is not in [8,14], the field value is set to 0.


mean 

given a list of integers,write a program to print the mean

mean - the average value of all the numbers.

input 

the input will be a single line of containing space-separated integers.

output

the first line of output should contain the mean, round off the value to 2 decimal places.

mean should always be a float value.

mean should be a float value when there are even number of elements, otherwise should be an integer value.

see sample input/output for the output format

explanation 

for example, if the given list of integers are 

2 4 5 6 7 8 2 4 5 2 3 8

the average of all the numbers is 4.67.

after sorting the array,

2 2 2 3 4 4 5 6 7 8 8



DOM.

image:

https://res.cloudinary.com/dfxicv9iv/image/upload/v1619260598/dynamic-dom-manipulations-3_bov0vg.gif

Delete btn is clicked

The blog element &the respective btn shouldbe deleted.

fill script code:

let blgList = [{

    blgName:"TechCrunch",

    uniqueNo:1,

  },

  {

    blgName:"Wired",

    uniqueNo:2,

  }

];


let blgsListContainer = document.getElementById("blogsListContainer");

function createAndAppendItem(blg) {

  let blgId = "blog" + blg.uniqueNo;

  let btnId = "button" + blg.uniqueNo;

let blgEl = document.createElement("li");

  blgEl.id = blgId;

  blgEl.textContent = blg.blgName;

  blgsListContainer.appendChild(blgEl);

let btnEl = document.createElement("button");

  btnEl.classList.add("btn", "btn-danger", "ml-3");

  btnEl.textContent ="Delete";

  btnEl.id = buttonId;


 // Write your code here


 blgEl.appendChild(btnEl);

}

for (let blg of blgList) {

  createAndAppendItem(blg);

}



  1. Create (4) java classes. Name them RunEmployee, Employee, FullTimeEmployee, PartTimeEmployee. The Runemployee class shall contain the main method and will be used to execute the program.
  2. Write a simple payroll program that will display employee's information. Refer to the UML Class Diagram for the names of the variable and method. This should be the sequence of the program upon execution:
  • Ask the user to input the name of the employee
  • Prompt the user to select between full time and part time by pressing either F (full time) or P (part time).
  • If F is press, ask the user to type his monthly salary. Then, display his name and monthly salary.

If P is pressed, ask the user to type his rate (pay) per hour and the number of hours he worked for the entire month separated by a space. Then, display his name and wage.



  1. Create a project named LabExer2
  2. Construct a simple purchasing program based on the UML Class Diagram below.
  • itemName: String
  • itemPrice: double
  • itemQuantity: int
  • amountDue: double


  • setItemName(StringnewitemName): void
  • setTotalCost(int quantity, double price): void
  • getItemName(): String
  • getTotalCost(): double
  • readInput(): void
  • writeOutput(): void

storing the input to the next variable name based on data type

For String s.nextLine()

For int s.nextInt()

For double: s.nextDouble()


Write a C++ program that prompts a user for three integers- the first denoting a month (1 to 12), the second denoting a day (1 to 31) and the third denoting a year. The output is displayed as "month day, year" string where month represents the name of the month.


For example, if inputs are 12, 15 and 2020 respectively, the output is December 15,


Write a program in C++ that reads text from the keyboard and stores it in a file named “File1.txt”. Also, for each of the specified prototypes given below, write the function definitions.

 void copyselc(ifstream& fp, ofstream& fp1):This function reads the contents of the file “File1.txt” and copies those lines from the file that begin with the character „#‟ to the file named “File2.txt”.

 void checksize(ifstream& fp1,ifstream& fp2):This function reads two files “File1.txt” and “File2.txt” and counts the number of characters in both the files. If the count of characters in both the files is same, then the function should print the message “Both Files are of the same size” else it should display “Size of the files is not same”.

 void dispNumNames(ifstream& fp):Assuming that the file “File2.txt” may also contain numbers (1 to 5), this function will read the contents from the file and display the number names for any numbers encountered. 


LATEST TUTORIALS
APPROVED BY CLIENTS