Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ please! ty! F=GR2m1m2 How would you write this as code? You might solve it in parts instead of one shot because it makes it

c++ please! ty!

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

F=GR2m1m2 How would you write this as code? You might solve it in parts instead of one shot because it makes it easier to check. It would look something like: MAIN CREATE f1, m1, m2, r, g, temp1, temp2, temp3 temp1=m1m2temp2=rrtemp3=temp11temp2f1=gtemp3 END MAIN Final note: don't cheat. If your temptation is to look online, don't. Come see us instead and ask questions - we're here to help. Remember, you're going to have to write code in your future job interviews, so learn it now in order to secure a high-paying job later. Assignment1A: Inverted Color: One of the truly fascinating things about the world is that it's infinite. What do we mean by this? As an example, we could ask you how many shades of yellow there are, and you'd soon realize there are an infinite number of them. Because computers don't have an infinite amount of storage space, they have to approximate the natural world. For colors, they most often use an additive color model comprised of (R)ed, (G)reen and (B)lue. They store these values either as a floating point number 0.01.0 (fully off to fully on), or an integer between 0 to 255 . Many art programs have a tool or filter called "Invert Color" which converts the on-screen colors and gives you their opposite. For example, a pure red (255,0,0) becomes a bright blue ( 0,255,255). You will create a program that calculates an inverted color based on what the user enters. Your task is to: a) Ask the user to individually enter in three values between 0 to 255 b) Read those three values in Don't worry about handling values outside that range - we'll learn how to do that later in the semester c) Invert each number d) Display the results e) Convert the inverted colors to floating point numbers f) Display those results You do not need to match the number of decimals precisely, as long as the answer is correct. Again, we'll learn how to do that later. The algorithm output is as shown below, with user input in bold. Save your source code in a file called Assignment1A (with a file extension of .cpp, .cs or .java) Sample Output: Enter a red value (0255):101 Enter a green value (0255):67 Enter a blue value (0-255): 33 The inverted color is red=154, green=188, blue =222 With floating points, that would be red =0.6039, green =0.7373, blue =0.8706 Assignment1B: Grocery List. When shopping for groceries, it's helpful to know how much it's going to cost you in advance - this helps you avoid an embarrassing situation in the check-out line. For this assignment, you're going to write a simple program that asks you for the name, quantity, and price of two grocery store items. It will then generate a grocery list for you, complete with the total price. (Later in the semester, we'll learn how to make a program that can create much larger lists, but we'll start small here). Call the file Assignment1B (with a file extension of .cpp, .cs or .java) Sample Output: What're you buying? Ice cream How many? 2 What do they cost? 2.25 What else're you buying? Celery How many? 5 What do they cost? 1.74 Your list: Ice Cream (2) $2.25($4.50 total) Celery (5) $1.74($8.7 total) Total Cost: $13.2 Assignment1C: Proper Dates: There are many different date formats used in the world, such as day/month/year, year/month/day, and month/day/year. Dealing with these is a common challenge for programmers working with international applications (like every website on the Internet). For this assignment, you will create a program that automates this process. You will ask the user to enter the year and day as a number (e.g. 9/2023) and the month as both a number and a String (e.g. 1, January). You will then print the following combinations of date formats: - day/month/year - year/month/day - month/day/year - Month (String) day, year - day Month (String) year Examples of the program are shown below. Save your source code in a file called Assignment1C (with a file extension of .cpp, .cs or .java) Sample Output: Enter the day (number): 9 Enter the month (number): 1 Enter the month (String): January Enter the year (number): 2023 Here are some ways to represent the date: 1/9/2023 2023/9/1 9/1/2023 January 9, 2023 9 January 2023

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Solaris 11.2 System Administration (oracle Press)

Authors: Harry Foxwell

1st Edition

007184421X, 9780071844215

More Books

Students also viewed these Databases questions