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

Develop a C program to copy the content of one file and store that content in another file.



Runtime Input :


Good Morning


Output :


Good Morning

The file named called EMPLOYEE.txt contains employee details such as employee number, name, designation and salary of employee. Write a program to create a file to store the details of employee (Use of structure and fwrite () & fread () functions).

Runtime Input :

101 xyz workshop 8500

102 nmo computer 6750

103 abc store 5890


In or Out

by CodeChum Admin

I'm quite into games now, so how about we play In or Out! When a given number is even, the team scores so we shall print "In", but if it's not an even number, then we print "Out". Simple, right?


Now let's get this game started.


A student spends a majority of his weekend playing and watching 

sports, thereby tiring him out and leading him to oversleep and often 

miss his Monday 8 AM math class. Suppose that the tuition per semes-

ter is $25,000 and the average semester consists of 15 units. If the math 

class meets three days a week, one hour each day for 15 weeks, and is a 

four-unit course, how much does each hour of math class cost the stu-

dent? Design an algorithm that computes the cost of each math class


Create a console program that will perform the following:


• Ask the user to enter the pieces of apple.


• Ask the user to enter the total price of the apple(s).


• Print the total price of the entered pieces of apple(s).


• Convert the entered price into a whole number, then display the values of the original


price and the converted price.


2. Name the project as DataTypesApp and the class as DataTypesProgram

This program will read integers from a file and find results from these integers.

Open the file, test to make sure the file opened. Use a loop to read the integers and process each integer as it is read. When End Of File is reached, close the file.

After all of the integers have been read and processed, print the results for the following output:

  • The integer count:
  • The sum of the integers:
  • The smallest integer:
  • The largest integer:
  • The average of the integers:

Use notepad, vim, or other simple text editor to create a file named file1.txt containing the following, with one integer per line.

Test the program two times.

Use the following data in the first test:

11
9
18
22
27
33
21
  

For the second test add an additional line containing the number 40.


Below are the structs defined in section 1.3. Your task now is to create complete program that utilizes these structs. Be creative on how you will use the structs in your program.



struct NameType{


string first;


string middle;


string last;


};



struct AddressType{


string address1;


string address2;


string city; string state;


string zip;


};



struct DateType{


int month;


int day;


int year;



};



struct ContactType{


string phone;


string cellphone;


string fax;


string pager;


string email;


};



struct EmployeeType{


NameType name;


string emp_id;


AddressType address;


DateType hireDate;


DateType quitDate;


ContactType contact;


string dept_id;


double salary;



};

Provide a loop with a menu. Repeat until the user selects quit. Prompt the user to select one of the menu items. Test for numbers that are not in the menu, provide an error message, and then continue. The menu shall contain:

1. Square   pattern
2. Triangle pattern
3. Diagonal pattern
4. Reverse diagonal pattern
5. Quit
  

After the user selects a pattern, allow them to specify the size. If the size is smaller than 1 or larger than 9, give them an error message and repeat the specification of the size.

Once the user has correctly selected a pattern and a size, print the pattern using the size specified.

Pattern 1 is a square. Example for size 4:

4444
4444
4444
4444
  

Pattern 2 is a triangle. Example for size 5:

5
55
555
5555
55555
  




Test the program once using each of these values in order:

Pattern 9; when that is rejected try:

Pattern 1, size 11; when that is rejected use:

Pattern 1, size 3

Pattern 2, size 4

Pattern 3, size 5

Pattern 4, size 6

Quit





This program will read integers from a file and find results from these integers.

Open the file, test to make sure the file opened. Use a loop to read the integers and process each integer as it is read. When End Of File is reached, close the file.

After all of the integers have been read and processed, print the results for the following output:

  • The integer count:
  • The sum of the integers:
  • The smallest integer:
  • The largest integer:
  • The average of the integers:

Use notepad, vim, or other simple text editor to create a file named file1.txt containing the following, with one integer per line.

Test the program two times.

Use the following data in the first test:

11
9
18
22
27
33
21
  

For the second test add an additional line containing the number 40.



How do I construct a loop for my input statements? Input question is, "What type of coffee would you like today?" If user selects a coffee, they pass, but if they fail, they must retry.


order = input("\n" + first_name.capitalize() + "," " " + "What type of Coffee would you like today?\n\n" +
              "\n".join(["Expresso", "Latte", "Cappuccino", "Mocha", "Frappuccino"]) + "\n\n")

order = order.replace("and a", "")
order = order.replace("and", "")
order = order.replace(",", "")
order = order.lower().split()

union = " and a " if len(order) > 1 else ""

plural = "" if len(order) > 1 else ""

order = input("\nYou have selected a" + " " + ", ".join(order[:-1]).title() + union + plural + order[-1].title()
              + "!" + " " + "\n\nIs this correct?\n\n")













LATEST TUTORIALS
APPROVED BY CLIENTS