Question

Assignment #3 Introduction to C Programming-COP 3223 Objectives 1 Togve students practice at typing in, compiling and nunningOutput Samgle Below ane some sample outputs of nunning the program. Note thatt these samples are NOT comprehensive test. You

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Note: Could you plz go through this code and let me know if u need any changes in this.Thank You
_________________


#include <stdio.h>

int main()
{
   //Declaring variables
   int interestRate, rem;
       float amount;
       int interest;
       int cnt1000 = 0, cnt500 = 0, cnt250 = 0;
  
//getting the input entered by the user
printf("How much was in the fund last year ? ");
       scanf("%f",&amount);

       printf("What is the yearly percentage rate ? ");
       scanf("%d",&interestRate);
      

       interest=(int)(amount*((float)interestRate/100));
      
       if(interest>=5000)
       {
       cnt1000 = (5000 / 1000);
       rem = interest-5000;
       }
       else
       {
           cnt1000=interest/1000;
           rem=interest%1000;
       }
      
       if(rem>=5000)
       {
           cnt500 = (5000 / 500);
           rem = interest-5000;          
       }
       else
       {
           cnt500 = (interest - (cnt1000 * 1000)) / 500;
           rem = interest % 500;          
       }

      
       cnt250 = (interest - (cnt1000 * 1000) - (cnt500 * 500)) / 250;
       rem = rem % 250;

       printf("%d $1000 scholarships will be awarded.\n",cnt1000);
               printf("%d $500 scholarships will be awarded.\n",cnt500);
                       printf("%d $250 scholarships will be awarded.\n",cnt250);
      
return 0;
}


_________________________

Output:

CAProgram Files (x86) Dev-Cpp\MinGW64\bin ScholarshipsAwards1000And 500And 250.exe How much was in the fund last year ? 12000

____________________

// IN JAVA

// AwardsAmount.java

import java.util.Scanner;

public class AwardsAmount {

   public static void main(String[] args) {
       int interestRate, rem;
       double amount;
       int interest;
       int cnt1000 = 0, cnt500 = 0, cnt250 = 0;
       /*
       * Creating an Scanner class object which is used to get the inputs
       * entered by the user
       */
       Scanner sc = new Scanner(System.in);
       System.out.print("How much was in the fund last year ? ");
       amount = sc.nextDouble();

       System.out.print("What is the yearly percentage rate ? ");
       interestRate=sc.nextInt();
      

       interest=(int)(amount*((double)interestRate/100));
      
       if(interest>=5000)
       {
       cnt1000 = (5000 / 1000);
       rem = interest-5000;
       }
       else
       {
           cnt1000=interest/1000;
           rem=interest%1000;
       }
      
       if(rem>=5000)
       {
           cnt500 = (5000 / 500);
           rem = interest-5000;          
       }
       else
       {
           cnt500 = (interest - (cnt1000 * 1000)) / 500;
           rem = interest % 500;          
       }

      
       cnt250 = (interest - (cnt1000 * 1000) - (cnt500 * 500)) / 250;
       rem = rem % 250;

       System.out.println(cnt1000 + " $1000 scholarships will be awarded.");
       System.out.println(cnt500 + " $500 scholarships will be awarded.");
       System.out.println(cnt250 + " $250 scholarships will be awarded.");

   }

}

________________________

Output:

How much was in the fund last year ? 40000
What is the yearly percentage rate ? 2
0 $1000 scholarships will be awarded.
1 $500 scholarships will be awarded.
1 $250 scholarships will be awarded.

_________________________

Output:

How much was in the fund last year ? 1200000
What is the yearly percentage rate ? 1
12000
5 $1000 scholarships will be awarded.
10 $500 scholarships will be awarded.
8 $250 scholarships will be awarded.

_______________Could you plz rate me well.Thank You

Add a comment
Know the answer?
Add Answer to:
Assignment #3 Introduction to C Programming-COP 3223 Objectives 1 Togve students practice at typing in, compiling...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C++ Programming Assignment Objectives: The objectives of Week 1 assignment is: Implement multiple selection using the...

    C++ Programming Assignment Objectives: The objectives of Week 1 assignment is: Implement multiple selection using the control statements ( i. e switch selection statement) Work with functions in C++ and to use the logical operators Assignment Purpose: To write a program that demonstrates the concepts of the control statements that we learned this week. Assignment Description: Problem Description: A company pays its employees as managers (who receive a fixed weekly salary), hourly workers (who receive a fixed hourly wage for...

  • Introduction to C Programming – COP 3223 1. To learn how to use arrays to store...

    Introduction to C Programming – COP 3223 1. To learn how to use arrays to store and retrieve data to help solving problems. 2. Reinforce use of input files. Introduction: Ninja Academy Ninjas are awesome! Your friend has not stopped talking about how cool ninjas and how they would like to become a ninja. To amuse your friend, you have decided to create a series of programs about ninjas. Problem: Mentorship (ninjamentors.c) It is time for your friend to select...

  • Programming in C with comments/steps 1. Overview The purpose of this assignment is to give you...

    Programming in C with comments/steps 1. Overview The purpose of this assignment is to give you some experience with writing functions that take in arguments and return values, as well as writing a program that consists of multiple files. This assignment also requires the use of a switch statement, in addition to more practice with printf& scanf declaring variables, using loops, and using logical expressions. For this assignment, you will prompt the user in the main function to enter their...

  • C programming is the main one and pick another code of choice!!! Background This assignment is...

    C programming is the main one and pick another code of choice!!! Background This assignment is based on one of the Big Ideas in this course, namely that reading C source code is a real aid in learning how to write C code. To that end, in this project, you write a program that scans C source from the 'Net and calculates some simple statistics. We're learning lots of concepts, and by running the program you write here on several...

  • Background: The Neil Peart Foundation is a private charitable organization classified as a 501(c)(3). The foundation...

    Background: The Neil Peart Foundation is a private charitable organization classified as a 501(c)(3). The foundation was created in 1956 when billionaire insurance mogul, Neil Peart, passed away. His will required the formation of the foundation and a substantial portion of his net wealth created the foundation’s endowment fund. The foundation’s purpose is to make grants to qualified community non-profit organizations so they may carry out programs in four main areas: public health, education, arts and culture, and environmental. The...

  • in c++ please Page 1 of 3 (PRO) Project Assignment Instructions Last Charged: 6/1/2020 Read and...

    in c++ please Page 1 of 3 (PRO) Project Assignment Instructions Last Charged: 6/1/2020 Read and follow the directions below carefully and perform the steps in the order listed. You will be solving one program as instructed and turning in your work electronically via an uploaded file within Eagle Online/Canvas and copy & paste the program to the Text Entry box as well. Make sure and check your work prior to uploading the assignment (NOTE: For Steps 1 & 2...

  • Assignment Predator / Prey Objectives Reading from and writing to text files Implementing mathematical formulas in...

    Assignment Predator / Prey Objectives Reading from and writing to text files Implementing mathematical formulas in C++ Implementing classes Using vectors Using command line arguments Modifying previously written code Tasks For this project, you will implement a simulation for predicting the future populations for a group of animals that we’ll call prey and their predators. Given the rate at which prey births exceed natural deaths, the rate of predation, the rate at which predator deaths exceeds births without a food...

  • Hi, i just need the highlighted ones. Thank you! CHAPTER 1 Understanding Personal Finance 33 LET'S...

    Hi, i just need the highlighted ones. Thank you! CHAPTER 1 Understanding Personal Finance 33 LET'S TALK ABOUT IT 1. Economic Growth. What tpes of federal government Federal Reserve. Describe some economic circumstances that might persuade the Federal Reserve to lower short-term inter- ctfoets to help stimulate economic growth affect 2 The Business Cycle. Where is the United States in the economic cycle now, and where does it seem to be heading? List some indicators that suggest in which direction...

  •   1. When it comes to financial matters, the views of Aristotle can be stated as:...

      1. When it comes to financial matters, the views of Aristotle can be stated as: a. usury is nature’s way of helping each other. b. the fact that money is barren makes it the ideal medium of exchange. c. charging interest is immoral because money is not productive. d. when you lend money, it grows more money. e. interest is too high if it can’t be paid back.  2. Since 2008, when the monetary base was about $800 billion,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT