0
Помогите с заданием пж
Руководство решило увеличить размер фонда заработной платы. Вам дана программа, которая берет в качестве вводных данных текущий фонд заработной платы и процент повышения. Она должна вывести в результат текущий бюджет, до повышения, затем вычислить и выдать в результат бюджет после повышения. Исправьте программу, завершив метод Increase() (который должен вычислить новый бюджет для фонда заработной платы) и выполните его, чтобы предоставленные результаты были корректными. Пример вводных данных 150000 15 Пример результата До повышения: 150000 После повышения: 172500
3 Respostas
+ 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;
        }
    }
}
+ 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 ; 
         
        }
+ 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);
        }






