Помогите с заданием пж | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

Помогите с заданием пж

Руководство решило увеличить размер фонда заработной платы. Вам дана программа, которая берет в качестве вводных данных текущий фонд заработной платы и процент повышения. Она должна вывести в результат текущий бюджет, до повышения, затем вычислить и выдать в результат бюджет после повышения. Исправьте программу, завершив метод Increase() (который должен вычислить новый бюджет для фонда заработной платы) и выполните его, чтобы предоставленные результаты были корректными. Пример вводных данных 150000 15 Пример результата До повышения: 150000 После повышения: 172500

25th Mar 2021, 12:05 AM
Сергей Черненко
Сергей Черненко - avatar
3 Respuestas
+ 1
Вот пример моей работы 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); Console.WriteLine("After the increase: " + salaryBudget); } //завершите метод static void Increase(ref int x) { int salaryBudget = Convert.ToInt32(Console.ReadLine()); int percent = Convert.ToInt32(Console.ReadLine()); x = (percent * salaryBudget) / 100; salaryBudget = salaryBudget + x; } } }
25th Mar 2021, 12:10 AM
Сергей Черненко
Сергей Черненко - avatar
+ 1
Моё решение. 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, ref percent ); Console.WriteLine("After the increase: "+ salaryBudget); } //завершите метод static void Increase(ref int x ,ref int y) { x = (y * x )/100 + x ; }
24th May 2021, 8:50 AM
Сергей Солдаткин
Сергей Солдаткин - avatar
+ 1
static void Main(string[] args) { int salaryBudget = Convert.ToInt32(Console.ReadLine()); int percent = Convert.ToInt32(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 int a,ref int percent) { a = a+(a*percent/100); }
25th Aug 2022, 9:52 PM
Nikita Deriabin
Nikita Deriabin - avatar