0

Help,pls.

Management has decided to increase the total salary budget. The program you are given takes the current salary budget and the raise percentage as input. It should output the salary budget before the increase, then calculate and output the budget with the raises included. Fix the program by completing the Increase() method (which should calculate the new salary budget) and calling it, so that the provided outputs work correctly. Sample Input 150000 15 Sample Output Before the increase: 150000 After the increase: 172500 Explanation The first input (150000) represents the initial value of salary budget, the second one is the raise percentage - 15%. So, after the increase, the salary budget should be 1.15*150000 = 172500. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { double salaryBudget = Convert.ToInt32(Console.ReadLine()); int percent = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Before the increase: " + salaryBudget); //завершите выполнение метода Increase(ref salaryBudget ); Console.WriteLine("After the increase: " + salaryBudget); } //завершите метод static void Increase(ref double x) { x= x * x; // ?????????? } } }

14th Apr 2021, 2:34 PM
Артем Попов
Артем Попов - avatar
6 Answers
14th Apr 2021, 2:55 PM
Mhd AlHaj Houssein
Mhd AlHaj Houssein - avatar
+ 1
Thnx a lot!)
14th Apr 2021, 2:54 PM
Артем Попов
Артем Попов - avatar
+ 1
This is the main hint in the question:1.15*150000 = 172500.
14th Apr 2021, 3:02 PM
The future is now thanks to science
The future is now thanks to science - avatar
0
class Program { static void Main(string[] args) { double salaryBudget = Convert.ToDouble(Console.ReadLine()); double percent = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Before the increase: " + salaryBudget); //complete the method call Increase(ref salaryBudget, ref percent); Console.WriteLine("After the increase: " + salaryBudget); } //complete the method static void Increase(ref double x, ref double y) { x = ((x * y)/y) + (x * (y/100)); } }
3rd Oct 2021, 3:45 AM
UnfilsdeBassar
UnfilsdeBassar - avatar
0
UnfilsdeBassar, why would you multiply x by y and then divide it by y immediately after? Wouldn't [ x = x + (x*(y/100) ] be better?
12th Jan 2022, 9:50 PM
Donnel Waddle Dee
Donnel Waddle Dee - avatar
0
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { int salaryBudget = Convert.ToInt32(Console.ReadLine()); int percent = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Before the increase: " + salaryBudget); Increase(ref salaryBudget, percent); Console.WriteLine("After the increase: " + salaryBudget); } static void Increase(ref int x, int y) { x = x*(y+100)/100; } } }
9th Oct 2022, 8:43 AM
kayvan kaynejad
kayvan kaynejad - avatar