The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 4 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
I am having trouble with question 2, can someone please help me solve this one. I am using Visual studio 2015 for an hp computer.
ECE175 Computer Programming for Engineering ApplicationsHomework Assignment 4Due Date: Tuesday February 23, 2016 11:59 PM, via D2LConventions:Name your C programs ashwxpy.cwherexcorresponds to the homework number andycorresponds to the problem number.Write comments to your programs. Programs with no comments will receive PARTIAL credit.For each program that you turn in, at least the following information should be included- Author:- Date created:- Brief (two lines) description of the program:Submission Instructions: Submit your .c files namedhw4p1.c, hw4p2.cvia D2L Dropbox.Note: No need to submit the text files (we will have them when grading your homework and ifyou code works, the output text files will be created)Text files available on D2L:"numbers.txt"for problem 1 and"weight.txt"for problem 2Problem 1: Write a C programthat finds all prime numbers contained in the file"numbers.txt" and writes them in the file "primes.txt".Your main programmustcall auser-defined functioncalled "primality". The functionreturns 1 if a number is prime and zero otherwise. The function prototype should be as follows:intprimality(int n);Note: You can use part of your program from HW 3 to create the function above.If your program works, there should be 1229 prime numbers written in the “primes.txt”.Problem 2:The table below shows the class of the customer, the weight of his or her luggageand the cost for transporting a customer’s luggage.ClassWeight (lb.)Cost($)Economy< 25025-401.50 for each pound over 25> 402.00 for each pound over 40Business< 35035-501.25 for each pound over 35> 501.50 for each pound over 50VIP< 600> 6030 (fixed cost)Write a C program that1)Read information from a text file named “weight.txt” containing customer ID, class andluggage weight. (The text file is also on D2L in the homework module).