Question

Tintin has just conquered Jupiter. However, on Jupiter there are not as many days as Earth. There are only n days. They have the same week structure: 5 week days and 2 weekends in a week And they take holidays only on weekends-never on a weekday Tintin wants to know, given some n, what is the maximum number of holidays that are possible in that year? Example, for input: 2.output is 2 , because both the days could be weekend. Example, for input: 14,output is 4 , because both we could have 4 weekends You just need to complete the method. You dont need to write the entire program You dont need to take any inputs from stdin. Please dont write header files, or the main method, Just complete the method given to you. You can define more methods if you want. Your Answer

please give the programming code for this

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

Please mention programming language. The following code will work for Java/C/ C++

int num_weeks = n / 7;
int extra_days = n % 7;
int week_ends = num_weeks * 2;

if(extra_days <= 2)
week_ends += extra_days;

return week_ends;

Add a comment
Know the answer?
Add Answer to:
please give the programming code for this Tintin has just conquered Jupiter. However, on Jupiter there...
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
  • You are the nurse manager on a large unit that has 14 FTE RNs on staff,...

    You are the nurse manager on a large unit that has 14 FTE RNs on staff, 25 FTE LPNs, and 15 FTE nursing aides, orderlies, and clerks. The schedule for the next 2 months is due in administration by next week, and you are beginning to work on it. Various requests have been submitted by personnel for vacations, educational conferences, time to attend a wedding, and long weekends, and a request from one nurse asks not to be rotated to...

  • Challenge: It's the weekend! Make an app tells you whether to stay home or go to...

    Challenge: It's the weekend! Make an app tells you whether to stay home or go to school based on what day of the week it is. In this challenge you will What should I do today? Select the day of the week: Add your own dropdown menu in design mode Add an event handler for the dropdown Wednesdayscla Write an if-statement that's slightly tricky It's a weekday! Go. We were unable to transcribe this imageo Otherwise (the day is a...

  • You are the nurse manager on a large unit that has 14 FTE RNs on staff,...

    You are the nurse manager on a large unit that has 14 FTE RNs on staff, 25 FTE LPNs, and 15 FTE nursing aides, orderlies, and clerks. The schedule for the next 2 months is due in administration by next week, and you are beginning to work on it. Various requests have been submitted by personnel for vacations, educational conferences, time to attend a wedding, and long weekends, and a request from one nurse asks not to be rotated to...

  • Can you give me the code for Question 12 through using R-programming? The Question instruction is...

    Can you give me the code for Question 12 through using R-programming? The Question instruction is Above question 9. Please help. Functional programming For problems 9-12, you are shown a for loop. Write a function f which can be used with the indicated functional programming construct to "replace" this for loop. For example, if you are given: n - length(input) output vector("double", n) for (i in 1:n) { output I[i-(input[i mean(input[i]))/sd( input[[i]]) # replace with: output <-map(iput, f) then a...

  • Design "MyWeek" class: (1) Data members: the class contains one private data field weekList. "wee...

    Design "MyWeek" class: (1) Data members: the class contains one private data field weekList. "weekList" has datatype of ArrayList, which will contain String objects of week/weekend days. There are no duplicated days in the list. Valid days are "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun". The weekList is not necessarily to be ordered (2) Constructors The instance of MyWeek can be constructed with (a) no argument (initialized weekList to empty), or (b) with one String argument which is one valid...

  • Please help me with the following C Programming project. I am providing the code I used...

    Please help me with the following C Programming project. I am providing the code I used which needs to be reworked to add the following requirements. Here is my code #include<stdio.h> char input; int main() { int i = 0; while (true){ scanf_s("%c", &input); if (input == 'X') break; printf("%c", input); } return 0; } Here are the requirements for the code plus and additional note what the code should have. Goals Understand the ASCII representation of character values. Understand...

  • This is a c# assignment Please do not post just the code, I don't even know...

    This is a c# assignment Please do not post just the code, I don't even know how to start the project. Please explain step by step how I could complete this assignment. Thank you for your time! Create a database that stores baseball player information. You will have the following columns. You will need to have the ability to add rows and display the records. You may use LINQ or Given example using an access accdb file... Name string Batting...

  • PLEASE UPLOAD or Write a simple PSEUDO CODE AND JAVA CODE for this program WITH COMMENTS...

    PLEASE UPLOAD or Write a simple PSEUDO CODE AND JAVA CODE for this program WITH COMMENTS IN BOTH TELLING WHAT EACH PART DOES. (I NEED BOTH CODES NOT JUST ONE OR THE OTHER) Problem Statement A golf club has a small tournament consisting of five golfers every weekend. The club president has asked you to design a program that does the following: Reads player’s names and their scores from the keyboard for each of the five golfers and simulates writing...

  • Use Java please Creating a calendar for a given year A shell for this assignment has...

    Use Java please Creating a calendar for a given year A shell for this assignment has been provided so that you can fill in the methods Homework 4 grading rubric 1. Output examples a. One Normal Year, 10% b. One Leap Year, 10% 2. Style Meaningful variable names, 10% b. Meaningful method names, 10 % c. Comments, Total: 10% . Do not comment every line. 5% . Comment non-obvious code. 5% a d. Indentation, 10% e. Block comment with name...

  • I need java code for the following problem. Lab 7: Methods 1. Write a Java program called Numbers that calls the following methods and displays the returned value: Write a method called cubelt that a...

    I need java code for the following problem. Lab 7: Methods 1. Write a Java program called Numbers that calls the following methods and displays the returned value: Write a method called cubelt that accepts one integer parameter and returns the value raised to the third power as an integer. o Write a method called randominRange that accepts two integer parameters representing a range. The method returns a random integer in the specified range inclusive. 2. o Write a method...

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